From db617705668841f1db21330c14f829c42e640f30 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 28 Aug 2019 15:02:28 +0200 Subject: Fix CMake errors around linker flags when targeting WASM * The -no-undefined linker option only makes sense for shared libraries. The WASM build is a static build though. * The -gc-sections linker option is only relevant for host tools and certainly applicable to the WASM toolchain. Change-Id: Ib8daec66a6d80f5025887448882dd891e6176268 Reviewed-by: Alexandru Croitor --- cmake/QtBuild.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmake/QtBuild.cmake') diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 3370cb7e6b..cc5fe5e07d 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -688,6 +688,9 @@ endmacro() function(qt_internal_add_link_flags_no_undefined target) + if (NOT QT_BUILD_SHARED_LIBS) + return() + endif() if (GCC OR CLANG) if(APPLE) set(no_undefined_flag "-Wl,-undefined,error") @@ -707,7 +710,7 @@ function(qt_internal_add_link_flags_gc_sections target visibility) message(FATAL_ERROR "Visibitily setting must be one of PRIVATE, INTERFACE or PUBLIC.") endif() - if (GCC OR CLANG) + if ((GCC OR CLANG) AND NOT EMSCRIPTEN) if(APPLE) set(gc_sections_flag "-Wl,-dead_strip") elseif(LINUX OR BSD OR SOLARIS OR WIN32 OR ANDROID) -- cgit v1.2.3