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 <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-08-28 15:02:28 +02:00
parent 4e5fc66c04
commit db61770566

View File

@ -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)