diff options
26 files changed, 157 insertions, 183 deletions
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 64420b3..f1b9e89 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -34,6 +34,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj endif() endfunction() +# FIXME(#26157) linker for Intel legacy compilers is not identified function(cmake_parse_implicit_link_info2 text log_var obj_regex) set(implicit_libs_tmp "") set(implicit_objs_tmp "") diff --git a/Modules/Linker/GNU.cmake b/Modules/Linker/GNU.cmake index cfb630f..1bc57e6 100644 --- a/Modules/Linker/GNU.cmake +++ b/Modules/Linker/GNU.cmake @@ -7,15 +7,13 @@ include_guard() block(SCOPE_FOR POLICIES) cmake_policy(SET CMP0054 NEW) +cmake_policy(SET CMP0140 NEW) -macro(__linker_gnu lang) +function(__linker_gnu lang) # define flags for linker depfile generation set(CMAKE_${lang}_LINKER_DEPFILE_FLAGS "LINKER:--dependency-file,<DEP_FILE>") set(CMAKE_${lang}_LINKER_DEPFILE_FORMAT gcc) - block(SCOPE_FOR VARIABLES - PROPAGATE CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED - CMAKE_${lang}_LINK_DEPENDS_USE_LINKER) if(NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) ## Ensure ninja tool is recent enough... if(CMAKE_GENERATOR MATCHES "^Ninja") @@ -61,7 +59,11 @@ macro(__linker_gnu lang) AND CMAKE_${lang}_COMPILER_LINKER_VERSION VERSION_LESS "2.41") set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE) endif() - endblock() -endmacro() + + return(PROPAGATE CMAKE_${lang}_LINKER_DEPFILE_FLAGS + CMAKE_${lang}_LINKER_DEPFILE_FORMAT + CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED + CMAKE_${lang}_LINK_DEPENDS_USE_LINKER) +endfunction() endblock() diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index 01b5f91..f372955 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -16,33 +16,6 @@ set(CMAKE_GNULD_IMAGE_VERSION set(CMAKE_GENERATOR_RC windres) -# Features for LINK_LIBRARY generator expression -## check linker capabilities -if(NOT DEFINED _CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - execute_process(COMMAND "${CMAKE_LINKER}" --help - OUTPUT_VARIABLE __linker_help - ERROR_VARIABLE __linker_help) - if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") - else() - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") - endif() - unset(__linker_help) -endif() -## WHOLE_ARCHIVE: Force loading all members of an archive -if(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - - macro(__cygwin_compiler_gnu lang) # Binary link rules. set(CMAKE_${lang}_CREATE_SHARED_MODULE diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index b26912d..f334c5f 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -141,11 +141,6 @@ set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY "PATH{LINKER:-weak_library,<LIBRARY>}N set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY_SUPPORTED TRUE) set(CMAKE_LINK_LIBRARY_WEAK_LIBRARY_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT) -# Defines LINK_LIBRARY feature to Force loading of all members of an archive -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-force_load,<LIB_ITEM>") -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - # default to searching for frameworks first if(NOT DEFINED CMAKE_FIND_FRAMEWORK) set(CMAKE_FIND_FRAMEWORK FIRST) diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake index 891422e..c79c181 100644 --- a/Modules/Platform/FreeBSD.cmake +++ b/Modules/Platform/FreeBSD.cmake @@ -27,33 +27,6 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) endforeach() -# Features for LINK_LIBRARY generator expression -## check linker capabilities -if(NOT DEFINED _CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - execute_process(COMMAND "${CMAKE_LINKER}" --help - OUTPUT_VARIABLE __linker_help - ERROR_VARIABLE __linker_help) - if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") - else() - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") - endif() - unset(__linker_help) -endif() -## WHOLE_ARCHIVE: Force loading all members of an archive -if(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - - # Features for LINK_GROUP generator expression ## RESCAN: request the linker to rescan static libraries until there is ## no pending undefined symbols diff --git a/Modules/Platform/Linker/Apple-AppleClang.cmake b/Modules/Platform/Linker/Apple-AppleClang.cmake index 71376e7..7582ae9 100644 --- a/Modules/Platform/Linker/Apple-AppleClang.cmake +++ b/Modules/Platform/Linker/Apple-AppleClang.cmake @@ -7,4 +7,10 @@ include_guard() macro(__apple_linker_appleclang lang) set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) + + # Features for LINK_LIBRARY generator expression + ## WHOLE_ARCHIVE: Force loading all members of an archive + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-force_load,<LIB_ITEM>") + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) + set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) endmacro() diff --git a/Modules/Platform/Linker/CYGWIN-GNU.cmake b/Modules/Platform/Linker/CYGWIN-GNU.cmake index 538f611..8e5b970 100644 --- a/Modules/Platform/Linker/CYGWIN-GNU.cmake +++ b/Modules/Platform/Linker/CYGWIN-GNU.cmake @@ -5,5 +5,10 @@ # This module is shared by multiple languages; use include blocker. include_guard() +include(Platform/Linker/GNU) + macro(__cygwin_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() endmacro() diff --git a/Modules/Platform/Linker/FreeBSD-GNU.cmake b/Modules/Platform/Linker/FreeBSD-GNU.cmake index 82f41fc..f884857 100644 --- a/Modules/Platform/Linker/FreeBSD-GNU.cmake +++ b/Modules/Platform/Linker/FreeBSD-GNU.cmake @@ -5,5 +5,10 @@ # This module is shared by multiple languages; use include blocker. include_guard() +include(Platform/Linker/GNU) + macro(__freebsd_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() endmacro() diff --git a/Modules/Platform/Linker/GNU-GNU.cmake b/Modules/Platform/Linker/GNU-GNU.cmake index f04e911..a1adf14 100644 --- a/Modules/Platform/Linker/GNU-GNU.cmake +++ b/Modules/Platform/Linker/GNU-GNU.cmake @@ -5,5 +5,10 @@ # This module is shared by multiple languages; use include blocker. include_guard() +include(Platform/Linker/GNU) + macro(__gnu_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() endmacro() diff --git a/Modules/Platform/Linker/GNU.cmake b/Modules/Platform/Linker/GNU.cmake new file mode 100644 index 0000000..5f11674 --- /dev/null +++ b/Modules/Platform/Linker/GNU.cmake @@ -0,0 +1,51 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +# WHOLE_ARCHIVE Feature for LINK_LIBRARY generator expression +## check linker capabilities +function(__cmake_set_whole_archive_feature __linker) + unset(__lang) + if(ARGC EQUAL "2") + set(__lang "${ARGV1}_") + endif() + + if(NOT __linker) + set(_CMAKE_${__lang}LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") + endif() + + if(NOT DEFINED _CMAKE_${__lang}LINKER_PUSHPOP_STATE_SUPPORTED) + execute_process(COMMAND "${__linker}" --help + OUTPUT_VARIABLE __linker_help + ERROR_VARIABLE __linker_help) + if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") + set(_CMAKE_${__lang}LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") + else() + set(_CMAKE_${__lang}LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") + endif() + endif() + ## WHOLE_ARCHIVE: Force loading all members of an archive + if(_CMAKE_${__lang}LINKER_PUSHPOP_STATE_SUPPORTED) + set(CMAKE_${__lang}LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" + "<LINK_ITEM>" + "LINKER:--pop-state" PARENT_SCOPE) + else() + set(CMAKE_${__lang}LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" + "<LINK_ITEM>" + "LINKER:--no-whole-archive" PARENT_SCOPE) + endif() + set(CMAKE_${__lang}LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE PARENT_SCOPE) + set(CMAKE_${__lang}LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT PARENT_SCOPE) +endfunction() + + +## Configure system linker +__cmake_set_whole_archive_feature("${CMAKE_LINKER}") + +endblock() diff --git a/Modules/Platform/Linker/Linux-GNU.cmake b/Modules/Platform/Linker/Linux-GNU.cmake index b5ca72b..6668141 100644 --- a/Modules/Platform/Linker/Linux-GNU.cmake +++ b/Modules/Platform/Linker/Linux-GNU.cmake @@ -5,5 +5,10 @@ # This module is shared by multiple languages; use include blocker. include_guard() +include(Platform/Linker/GNU) + macro(__linux_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() endmacro() diff --git a/Modules/Platform/Linker/NetBSD-GNU.cmake b/Modules/Platform/Linker/NetBSD-GNU.cmake index ef2812a..f06e491 100644 --- a/Modules/Platform/Linker/NetBSD-GNU.cmake +++ b/Modules/Platform/Linker/NetBSD-GNU.cmake @@ -5,5 +5,10 @@ # This module is shared by multiple languages; use include blocker. include_guard() +include(Platform/Linker/GNU) + macro(__netbsd_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() endmacro() diff --git a/Modules/Platform/Linker/OpenBSD-GNU.cmake b/Modules/Platform/Linker/OpenBSD-GNU.cmake index 50a9d4d..b30e467 100644 --- a/Modules/Platform/Linker/OpenBSD-GNU.cmake +++ b/Modules/Platform/Linker/OpenBSD-GNU.cmake @@ -5,5 +5,10 @@ # This module is shared by multiple languages; use include blocker. include_guard() +include(Platform/Linker/GNU) + macro(__openbsd_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() endmacro() diff --git a/Modules/Platform/Linker/SerenityOS-GNU.cmake b/Modules/Platform/Linker/SerenityOS-GNU.cmake index 36ea070..9b06bfb 100644 --- a/Modules/Platform/Linker/SerenityOS-GNU.cmake +++ b/Modules/Platform/Linker/SerenityOS-GNU.cmake @@ -5,5 +5,10 @@ # This module is shared by multiple languages; use include blocker. include_guard() +include(Platform/Linker/GNU) + macro(__serenityos_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() endmacro() diff --git a/Modules/Platform/Linker/SunOS-GNU.cmake b/Modules/Platform/Linker/SunOS-GNU.cmake index 3a2b541..693e31a 100644 --- a/Modules/Platform/Linker/SunOS-GNU.cmake +++ b/Modules/Platform/Linker/SunOS-GNU.cmake @@ -5,5 +5,10 @@ # This module is shared by multiple languages; use include blocker. include_guard() +include(Platform/Linker/GNU) + macro(__sunos_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() endmacro() diff --git a/Modules/Platform/Linker/SunOS-Solaris.cmake b/Modules/Platform/Linker/SunOS-Solaris.cmake index 6b2083a..cf82bf8 100644 --- a/Modules/Platform/Linker/SunOS-Solaris.cmake +++ b/Modules/Platform/Linker/SunOS-Solaris.cmake @@ -5,5 +5,23 @@ # This module is shared by multiple languages; use include blocker. include_guard() +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + macro(__sunos_linker_solaris lang) + # Features for LINK_LIBRARY generator expression + ## WHOLE_ARCHIVE: Force loading all members of an archive + if (CMAKE_SYSTEM_VERSION VERSION_GREATER "5.10") + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" + "<LINK_ITEM>" + "LINKER:--no-whole-archive") + else() + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-z,allextract" + "<LINK_ITEM>" + "LINKER:-z,defaultextract") + endif() + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) + set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) endmacro() + +endblock() diff --git a/Modules/Platform/Linker/Windows-GNU.cmake b/Modules/Platform/Linker/Windows-GNU.cmake index 1d726bf..a5c4417 100644 --- a/Modules/Platform/Linker/Windows-GNU.cmake +++ b/Modules/Platform/Linker/Windows-GNU.cmake @@ -5,6 +5,10 @@ # This module is shared by multiple languages; use include blocker. include_guard() +include(Platform/Linker/GNU) macro(__windows_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() endmacro() diff --git a/Modules/Platform/Linker/Windows-MSVC.cmake b/Modules/Platform/Linker/Windows-MSVC.cmake index 223a057..2eb5713 100644 --- a/Modules/Platform/Linker/Windows-MSVC.cmake +++ b/Modules/Platform/Linker/Windows-MSVC.cmake @@ -5,7 +5,31 @@ # This module is shared by multiple languages; use include blocker. include_guard() +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +# Features for LINK_LIBRARY generator expression +if(MSVC_VERSION GREATER "1900") + ## WHOLE_ARCHIVE: Force loading all members of an archive + set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:<LIBRARY>") + set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) + set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) +endif() macro(__windows_linker_msvc lang) set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD DEDUPLICATION=ALL) + + # Features for LINK_LIBRARY generator expression + if(DEFINED CMAKE_${lang}_COMPILER_LINKER_VERSION) + if (CMAKE_${lang}_COMPILER_LINKER_VERSION GREATER_EQUAL "14.10") + ## WHOLE_ARCHIVE: Force loading all members of an archive + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:<LIBRARY>") + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) + set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) + else() + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED FALSE) + endif() + endif() endmacro() + +endblock() diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake index 3b5ca59..95debf9 100644 --- a/Modules/Platform/Linux-Intel.cmake +++ b/Modules/Platform/Linux-Intel.cmake @@ -39,6 +39,11 @@ macro(__linux_compiler_intel lang) set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") + # FIXME(#26157): compute CMAKE_<LANG>_COMPILER_LINKER* variables + # in the meantime, enforce deactivation of push/pop state linker options + # because xild front-end linker do not support these options even if the platform linker does... + set(_CMAKE_${lang}_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") + set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) if(XIAR) diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index a73bbf7..5b61dd6 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -20,32 +20,6 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) endforeach() -# Features for LINK_LIBRARY generator expression -## check linker capabilities -if(NOT DEFINED _CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - execute_process(COMMAND "${CMAKE_LINKER}" --help - OUTPUT_VARIABLE __linker_help - ERROR_VARIABLE __linker_help) - if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") - else() - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") - endif() - unset(__linker_help) -endif() -## WHOLE_ARCHIVE: Force loading all members of an archive -if(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - # Features for LINK_GROUP generator expression ## RESCAN: request the linker to rescan static libraries until there is ## no pending undefined symbols diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake index 892d55b..110212b 100644 --- a/Modules/Platform/NetBSD.cmake +++ b/Modules/Platform/NetBSD.cmake @@ -13,33 +13,6 @@ set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -# Features for LINK_LIBRARY generator expression -## check linker capabilities -if(NOT DEFINED _CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - execute_process(COMMAND "${CMAKE_LINKER}" --help - OUTPUT_VARIABLE __linker_help - ERROR_VARIABLE __linker_help) - if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") - else() - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") - endif() - unset(__linker_help) -endif() -## WHOLE_ARCHIVE: Force loading all members of an archive -if(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - - # Features for LINK_GROUP generator expression ## RESCAN: request the linker to rescan static libraries until there is ## no pending undefined symbols diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index 25e95e6..e01e892 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -8,21 +8,6 @@ if(CMAKE_SYSTEM MATCHES "SunOS-4") endif() -# Features for LINK_LIBRARY generator expression -## WHOLE_ARCHIVE: Force loading all members of an archive -if (CMAKE_SYSTEM_VERSION VERSION_GREATER "5.10") - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-z,allextract" - "<LINK_ITEM>" - "LINKER:-z,defaultextract") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - - # Features for LINK_GROUP generator expression if (CMAKE_SYSTEM_VERSION VERSION_GREATER "5.9") ## RESCAN: request the linker to rescan static libraries until there is diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 489f7bf..7a05492 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -133,14 +133,6 @@ macro(__windows_compiler_clang_gnu lang) string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER) set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames") - # Features for LINK_LIBRARY generator expression - if(MSVC_VERSION GREATER "1900") - ## WHOLE_ARCHIVE: Force loading all members of an archive - set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:<LIBRARY>") - set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) - set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - endif() - enable_language(RC) endmacro() diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 1a4159b..7dc92cd 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -64,32 +64,6 @@ if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]") endif() -# Features for LINK_LIBRARY generator expression -## check linker capabilities -if(NOT DEFINED _CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - execute_process(COMMAND "${CMAKE_LINKER}" --help - OUTPUT_VARIABLE __linker_help - ERROR_VARIABLE __linker_help) - if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") - else() - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") - endif() - unset(__linker_help) -endif() -## WHOLE_ARCHIVE: Force loading all members of an archive -if(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - # Features for LINK_GROUP generator expression ## RESCAN: request the linker to rescan static libraries until there is ## no pending undefined symbols diff --git a/Modules/Platform/Windows-IntelLLVM.cmake b/Modules/Platform/Windows-IntelLLVM.cmake index 517d959..ba2cc9c 100644 --- a/Modules/Platform/Windows-IntelLLVM.cmake +++ b/Modules/Platform/Windows-IntelLLVM.cmake @@ -32,14 +32,6 @@ macro(__windows_compiler_intel lang) set(CMAKE_LINK_DEF_FILE_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/DEF:") set(CMAKE_LIBRARY_PATH_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/LIBPATH:") - # Features for LINK_LIBRARY generator expression - if(MSVC_VERSION GREATER "1900") - ## WHOLE_ARCHIVE: Force loading all members of an archive - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:<LIBRARY>") - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) - set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - endif() - set(CMAKE_${lang}_LINK_EXECUTABLE "${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <LINK_LIBRARIES> /link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_SHARED_LIBRARY diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 07f0de4..189d1fd 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -353,14 +353,6 @@ else() endif() unset(__WINDOWS_MSVC_CMP0141) -# Features for LINK_LIBRARY generator expression -if(MSVC_VERSION GREATER "1900") - ## WHOLE_ARCHIVE: Force loading all members of an archive - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "/WHOLEARCHIVE:<LIBRARY>") - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) - set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) -endif() - macro(__windows_compiler_msvc lang) if(NOT MSVC_VERSION LESS 1400) |