diff options
author | Brad King <brad.king@kitware.com> | 2022-03-21 18:35:52 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-03-21 18:35:59 (GMT) |
commit | a4b04e62fc44f36982308e9d3be6611b5f9cd4ce (patch) | |
tree | 09bb237460933d208e3021493f7583601ac6a206 /Help/variable | |
parent | ccc11d0776109c9d37f12b8332f9bc27f3bb41bf (diff) | |
parent | dabe56de58a32768f0dff740f83539ab8337b132 (diff) | |
download | CMake-a4b04e62fc44f36982308e9d3be6611b5f9cd4ce.zip CMake-a4b04e62fc44f36982308e9d3be6611b5f9cd4ce.tar.gz CMake-a4b04e62fc44f36982308e9d3be6611b5f9cd4ce.tar.bz2 |
Merge topic 'LINK_LIBRARY-WHOLE_ARCHIVE'
dabe56de58 genex-LINK_LIBRARY: Add feature WHOLE_ARCHIVE
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: huangqinjin <huangqinjin@gmail.com>
Merge-request: !7064
Diffstat (limited to 'Help/variable')
-rw-r--r-- | Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt | 18 | ||||
-rw-r--r-- | Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt | 18 |
2 files changed, 27 insertions, 9 deletions
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 |