summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake28
-rw-r--r--Modules/Platform/Darwin.cmake8
-rw-r--r--Modules/Platform/FreeBSD.cmake27
-rw-r--r--Modules/Platform/Linux.cmake25
-rw-r--r--Modules/Platform/NetBSD.cmake27
-rw-r--r--Modules/Platform/SunOS.cmake14
-rw-r--r--Modules/Platform/Windows-Clang.cmake7
-rw-r--r--Modules/Platform/Windows-GNU.cmake25
-rw-r--r--Modules/Platform/Windows-MSVC.cmake9
9 files changed, 168 insertions, 2 deletions
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
index b81bd4d..ef64012 100644
--- a/Modules/Platform/CYGWIN-GNU.cmake
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -14,6 +14,34 @@ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,--enable-auto-import")
set(CMAKE_GNULD_IMAGE_VERSION
"-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>")
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)
+
+
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 a27bb36..ec88a37 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -108,7 +108,7 @@ foreach(lang C CXX Fortran OBJC OBJCXX)
set(CMAKE_${lang}_FRAMEWORK_SEARCH_FLAG -F)
endforeach()
-# Defines link features for frameworks
+# Defines LINK_LIBRARY features for frameworks
set(CMAKE_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,<LIBRARY>")
set(CMAKE_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
@@ -121,7 +121,7 @@ set(CMAKE_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE)
set(CMAKE_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,<LIBRARY>")
set(CMAKE_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE)
-# Defines link features for libraries
+# Defines LINK_LIBRARY features for libraries
set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY "PATH{LINKER:-needed_library <LIBRARY>}NAME{LINKER:-needed-l<LIB_ITEM>}")
set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY_SUPPORTED TRUE)
@@ -131,6 +131,10 @@ set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY_SUPPORTED TRUE)
set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY "PATH{LINKER:-weak_library <LIBRARY>}NAME{LINKER:-weak-l<LIB_ITEM>}")
set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY_SUPPORTED TRUE)
+# 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)
+
# 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 4a4c00d..4c8cb6a 100644
--- a/Modules/Platform/FreeBSD.cmake
+++ b/Modules/Platform/FreeBSD.cmake
@@ -26,4 +26,31 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
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)
+
+
include(Platform/UnixPaths)
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
index 95102e1..a7e58ab 100644
--- a/Modules/Platform/Linux.cmake
+++ b/Modules/Platform/Linux.cmake
@@ -20,6 +20,31 @@ 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)
+
# 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 d99cb4a..8774159 100644
--- a/Modules/Platform/NetBSD.cmake
+++ b/Modules/Platform/NetBSD.cmake
@@ -12,4 +12,31 @@ set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
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)
+
+
include(Platform/UnixPaths)
diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake
index e01e892..b8a302c 100644
--- a/Modules/Platform/SunOS.cmake
+++ b/Modules/Platform/SunOS.cmake
@@ -8,6 +8,20 @@ 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)
+
+
# 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 e7e975d..7600c8d 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -113,6 +113,13 @@ 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)
+ endif()
+
enable_language(RC)
endmacro()
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 3c24c21..b464169 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -45,6 +45,31 @@ 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)
+
# 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-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index b2cc6f4..e74ec9e 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -331,6 +331,15 @@ else()
endif()
unset(__WINDOWS_MSVC_CMP0091)
+
+# 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)
+endif()
+
+
macro(__windows_compiler_msvc lang)
if(NOT MSVC_VERSION LESS 1400)
# for 2005 make sure the manifest is put in the dll with mt