diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2023-10-30 10:51:07 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2023-11-09 18:20:40 (GMT) |
commit | 7b99c42e57b11afe818827ac537ca020c020addd (patch) | |
tree | 8685083b5091ee50151974a827ecf2c06f4ed62f /Modules/Platform | |
parent | 07501c16784f7e333da2f0d9045c029babfa38ea (diff) | |
download | CMake-7b99c42e57b11afe818827ac537ca020c020addd.zip CMake-7b99c42e57b11afe818827ac537ca020c020addd.tar.gz CMake-7b99c42e57b11afe818827ac537ca020c020addd.tar.bz2 |
Link step: Enable to configure deduplication of libraries
Some platforms, Apple or Windows for instance, do not require to duplicate
static libraries to resolve mutual dependencies. Moreover, Xcode version 15
emits a warning if a library is duplicated.
On Windows, enable a better control of libraries order.
Fixes: #20722, #25297
Diffstat (limited to 'Modules/Platform')
-rw-r--r-- | Modules/Platform/AIX-GNU.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/AIX-XL.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/Apple-Clang.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/Windows-Clang.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 2 |
5 files changed, 9 insertions, 0 deletions
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index a9aa8e0..106eaec 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -16,6 +16,8 @@ macro(__aix_compiler_gnu lang) set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1) set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=ALL) + if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 7 OR CMAKE_SYSTEM_VERSION VERSION_LESS 7.1) unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY) endif() diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake index 902cbb3..c225de9 100644 --- a/Modules/Platform/AIX-XL.cmake +++ b/Modules/Platform/AIX-XL.cmake @@ -17,6 +17,7 @@ macro(__aix_compiler_xl lang) set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ") set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=ALL) set(_OBJECTS " <OBJECTS>") if(DEFINED CMAKE_XL_CreateExportList AND CMAKE_XL_CreateExportList STREQUAL "") diff --git a/Modules/Platform/Apple-Clang.cmake b/Modules/Platform/Apple-Clang.cmake index 5fe4300..7986a37 100644 --- a/Modules/Platform/Apple-Clang.cmake +++ b/Modules/Platform/Apple-Clang.cmake @@ -15,6 +15,8 @@ macro(__apple_compiler_clang lang) set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ") endif() + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=ALL) + set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK "-framework <LIBRARY>") set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index a58c2d6..f081f42 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -54,6 +54,8 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD UNICITY=ALL) + # linker selection set(CMAKE_${lang}_USING_LINKER_DEFAULT "-fuse-ld=lld-link") set(CMAKE_${lang}_USING_LINKER_SYSTEM "-fuse-ld=link") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 1fbf0cc..48e7c4e 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -513,6 +513,8 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_DEPFILE_FORMAT msvc) endif() + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD UNICITY=ALL) + # linker selection set(CMAKE_${lang}_USING_LINKER_SYSTEM "${CMAKE_LINKER_LINK}") set(CMAKE_${lang}_USING_LINKER_LLD "${CMAKE_LINKER_LLD}") |