diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2022-03-10 15:54:43 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2022-03-17 22:07:59 (GMT) |
commit | dabe56de58a32768f0dff740f83539ab8337b132 (patch) | |
tree | 1804ac7f935f1344ffeca22388d3e07d85d3350f /Help | |
parent | 3a37fda6a2b4f28fdd7efe58f4a0b7570404a7d4 (diff) | |
download | CMake-dabe56de58a32768f0dff740f83539ab8337b132.zip CMake-dabe56de58a32768f0dff740f83539ab8337b132.tar.gz CMake-dabe56de58a32768f0dff740f83539ab8337b132.tar.bz2 |
genex-LINK_LIBRARY: Add feature WHOLE_ARCHIVE
Diffstat (limited to 'Help')
-rw-r--r-- | Help/manual/cmake-generator-expressions.7.rst | 4 | ||||
-rw-r--r-- | Help/release/dev/LINK_LIBRARY-WHOLE_ARCHIVE.rst | 14 | ||||
-rw-r--r-- | Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt | 18 | ||||
-rw-r--r-- | Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt | 18 |
4 files changed, 43 insertions, 11 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 2394eb2..b79cf3a 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -1125,9 +1125,9 @@ Output-Related Expressions add_library(lib1 STATIC ...) add_library(lib2 ...) - target_link_libraries(lib2 PRIVATE "$<LINK_LIBRARY:whole_archive,lib1>") + target_link_libraries(lib2 PRIVATE "$<LINK_LIBRARY:load_archive,lib1>") - This specify to use the ``lib1`` target with feature ``whole_archive`` for + This specify to use the ``lib1`` target with feature ``load_archive`` for linking target ``lib2``. The feature must have be defined by :variable:`CMAKE_<LANG>_LINK_LIBRARY_USING_<FEATURE>` variable or, if :variable:`CMAKE_<LANG>_LINK_LIBRARY_USING_<FEATURE>_SUPPORTED` is false, diff --git a/Help/release/dev/LINK_LIBRARY-WHOLE_ARCHIVE.rst b/Help/release/dev/LINK_LIBRARY-WHOLE_ARCHIVE.rst new file mode 100644 index 0000000..abaf3a9 --- /dev/null +++ b/Help/release/dev/LINK_LIBRARY-WHOLE_ARCHIVE.rst @@ -0,0 +1,14 @@ +LINK_LIBRARY-WHOLE_ARCHIVE +-------------------------- + +* The :genex:`LINK_LIBRARY` generator expression gained the feature + ``WHOLE_ARCHIVE`` to force load of all members in a static library. This + feature is supported on the following target platforms: + + * all ``Apple`` variants + * ``Linux`` + * all ``BSD`` variants + * ``SunOS`` + * ``Windows`` + * ``CYGWIN`` + * ``MSYS`` diff --git a/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt b/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt index ad393b0..ec293d3 100644 --- a/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt +++ b/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt @@ -46,27 +46,27 @@ is offered by various environments but with a specific syntax: .. code-block:: cmake - set(CMAKE_C_LINK_LIBRARY_USING_whole_archive_SUPPORTED TRUE) + set(CMAKE_C_LINK_LIBRARY_USING_load_archive_SUPPORTED TRUE) if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang") - set(CMAKE_C_LINK_LIBRARY_USING_whole_archive "-force_load <LIB_ITEM>") + set(CMAKE_C_LINK_LIBRARY_USING_load_archive "-force_load <LIB_ITEM>") elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(CMAKE_C_LINK_LIBRARY_USING_whole_archive "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") + set(CMAKE_C_LINK_LIBRARY_USING_load_archive "LINKER:--push-state,--whole-archive" + "<LINK_ITEM>" + "LINKER:--pop-state") elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") - set(CMAKE_C_LINK_LIBRARY_USING_whole_archive "/WHOLEARCHIVE:<LIBRARY>") + set(CMAKE_C_LINK_LIBRARY_USING_load_archive "/WHOLEARCHIVE:<LIBRARY>") else() # feature not yet supported for the other environments - set(CMAKE_C_LINK_LIBRARY_USING_whole_archive_SUPPORTED FALSE) + set(CMAKE_C_LINK_LIBRARY_USING_load_archive_SUPPORTED FALSE) endif() add_library(lib1 STATIC ...) add_library(lib2 SHARED ...) - if(CMAKE_C_LINK_LIBRARY_USING_whole_archive_SUPPORTED) + if(CMAKE_C_LINK_LIBRARY_USING_load_archive_SUPPORTED) target_link_libraries(lib2 PRIVATE - "$<LINK_LIBRARY:whole_archive,lib1,$<IF:$<LINK_LANG_AND_ID:C,Clang>,libexternal.a,external>>") + "$<LINK_LIBRARY:load_archive,lib1,$<IF:$<LINK_LANG_AND_ID:C,Clang>,libexternal.a,external>>") else() target_link_libraries(lib2 PRIVATE lib1 external) endif() diff --git a/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt b/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt index 936bd31..e4fa0ed8 100644 --- a/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt +++ b/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt @@ -5,6 +5,24 @@ useful with :prop_tgt:`LINK_LIBRARY_OVERRIDE` and :prop_tgt:`LINK_LIBRARY_OVERRIDE_<LIBRARY>` target properties. +**Features available for a subset of environments** + +``WHOLE_ARCHIVE`` + Force load of all members in a static library. + + Target platforms supported: all ``Apple`` variants, ``Linux``, all ``BSD`` + variants, ``SunOS``, ``Windows``, ``CYGWIN``, and ``MSYS``. + + Platform-specific notes: + + * On Apple platforms, the library must be specified as a CMake target name, a + library file name (such as ``libfoo.a``), or a library file path (such as + ``/path/to/libfoo.a``). It cannot be specified as a plain library name + (such as ``foo``, where ``foo`` is not CMake target), due to a limitation + in the Apple linker. + * On Windows platforms, for ``MSVC`` or MSVC-like toolchains, the version + must be greater than ``1900``. + **Features available in Apple environments** It is assumed that the linker used is the one provided by `XCode` or is |