From 397ee55cd62dcfcbafb4ff62b189a4192e07d1e5 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Wed, 16 Feb 2022 18:34:28 +0100 Subject: genex-LINK_LIBRARY: rename configuration variables To be more consistent between genex and variables as well as the forecomming LINK_GROUP genex, rename variable *_LINK_USING_* in *_LINK_LIBRARY_USING_* --- Help/manual/cmake-generator-expressions.7.rst | 18 ++-- Help/manual/cmake-variables.7.rst | 8 +- Help/prop_tgt/LINK_LIBRARY_OVERRIDE.rst | 8 +- Help/prop_tgt/LINK_LIBRARY_OVERRIDE_LIBRARY.rst | 8 +- Help/release/dev/Genex-LINK_LIBRARY.rst | 6 +- .../CMAKE_LANG_LINK_LIBRARY_USING_FEATURE.rst | 26 +++++ ...E_LANG_LINK_LIBRARY_USING_FEATURE_SUPPORTED.rst | 13 +++ Help/variable/CMAKE_LANG_LINK_USING_FEATURE.rst | 26 ----- .../CMAKE_LANG_LINK_USING_FEATURE_SUPPORTED.rst | 13 --- Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.rst | 31 ++++++ Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt | 112 +++++++++++++++++++++ .../CMAKE_LINK_LIBRARY_USING_FEATURE_SUPPORTED.rst | 14 +++ Help/variable/CMAKE_LINK_USING_FEATURE.rst | 30 ------ Help/variable/CMAKE_LINK_USING_FEATURE.txt | 111 -------------------- .../CMAKE_LINK_USING_FEATURE_SUPPORTED.rst | 14 --- Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt | 8 +- Modules/CMakeGenericSystem.cmake | 2 +- Modules/Compiler/Clang-CUDA.cmake | 16 +-- Modules/Platform/Apple-Apple-Swift.cmake | 16 +-- Modules/Platform/Apple-NVIDIA-CUDA.cmake | 16 +-- Modules/Platform/Darwin.cmake | 16 +-- Source/cmComputeLinkDepends.cxx | 13 +-- Source/cmComputeLinkInformation.cxx | 4 +- .../RunCMake/GenEx-LINK_LIBRARY/bad-feature2.cmake | 2 +- .../GenEx-LINK_LIBRARY/bad-feature3-stderr.txt | 2 +- .../RunCMake/GenEx-LINK_LIBRARY/bad-feature3.cmake | 4 +- .../GenEx-LINK_LIBRARY/bad-feature4-stderr.txt | 2 +- .../RunCMake/GenEx-LINK_LIBRARY/bad-feature4.cmake | 4 +- .../GenEx-LINK_LIBRARY/bad-feature5-stderr.txt | 2 +- .../RunCMake/GenEx-LINK_LIBRARY/bad-feature5.cmake | 4 +- .../GenEx-LINK_LIBRARY/bad-feature6-stderr.txt | 2 +- .../RunCMake/GenEx-LINK_LIBRARY/bad-feature6.cmake | 4 +- .../GenEx-LINK_LIBRARY/bad-feature7-stderr.txt | 2 +- .../RunCMake/GenEx-LINK_LIBRARY/bad-feature7.cmake | 4 +- .../GenEx-LINK_LIBRARY/compatible-features.cmake | 12 +-- .../GenEx-LINK_LIBRARY/feature-not-supported.cmake | 4 +- .../incompatible-features1.cmake | 8 +- .../incompatible-features2.cmake | 10 +- .../incompatible-features3.cmake | 10 +- .../GenEx-LINK_LIBRARY/library-ignored.cmake | 4 +- .../nested-compatible-features.cmake | 4 +- .../nested-incompatible-features.cmake | 8 +- .../RunCMake/GenEx-LINK_LIBRARY/only-targets.cmake | 4 +- .../GenEx-LINK_LIBRARY/override-features3.cmake | 4 +- .../GenEx-LINK_LIBRARY/override-features4.cmake | 4 +- .../GenEx-LINK_LIBRARY/target_link_options.cmake | 2 +- .../LINK_LIBRARY.cmake | 44 ++++---- .../imported-target-stdout.txt | 4 +- .../weak_library.cmake | 6 +- .../whole_archive.cmake | 20 ++-- 50 files changed, 357 insertions(+), 352 deletions(-) create mode 100644 Help/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE.rst create mode 100644 Help/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE_SUPPORTED.rst delete mode 100644 Help/variable/CMAKE_LANG_LINK_USING_FEATURE.rst delete mode 100644 Help/variable/CMAKE_LANG_LINK_USING_FEATURE_SUPPORTED.rst create mode 100644 Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.rst create mode 100644 Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt create mode 100644 Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE_SUPPORTED.rst delete mode 100644 Help/variable/CMAKE_LINK_USING_FEATURE.rst delete mode 100644 Help/variable/CMAKE_LINK_USING_FEATURE.txt delete mode 100644 Help/variable/CMAKE_LINK_USING_FEATURE_SUPPORTED.rst diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 7c34671..0e9060d 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -1125,23 +1125,23 @@ Output-Related Expressions add_library(lib1 STATIC ...) add_library(lib2 ...) - target_link_libraries(lib2 PRIVATE $) + target_link_libraries(lib2 PRIVATE "$") This specify to use the ``lib1`` target with feature ``whole_archive`` for linking target ``lib2``. The feature must have be defined by - :variable:`CMAKE__LINK_USING_` variable or, if - :variable:`CMAKE__LINK_USING__SUPPORTED` is false, - by :variable:`CMAKE_LINK_USING_` variable. + :variable:`CMAKE__LINK_LIBRARY_USING_` variable or, if + :variable:`CMAKE__LINK_LIBRARY_USING__SUPPORTED` is false, + by :variable:`CMAKE_LINK_LIBRARY_USING_` variable. .. note:: The evaluation of this generator expression will use, for the following variables, the values defined at the level of the creation of the target: - * :variable:`CMAKE__LINK_USING__SUPPORTED` - * :variable:`CMAKE__LINK_USING_` - * :variable:`CMAKE_LINK_USING__SUPPORTED` - * :variable:`CMAKE_LINK_USING_` + * :variable:`CMAKE__LINK_LIBRARY_USING__SUPPORTED` + * :variable:`CMAKE__LINK_LIBRARY_USING_` + * :variable:`CMAKE_LINK_LIBRARY_USING__SUPPORTED` + * :variable:`CMAKE_LINK_LIBRARY_USING_` This expression can only be used to specify link libraries (i.e. part of :command:`link_libraries` or :command:`target_link_libraries` commands and @@ -1170,7 +1170,7 @@ Output-Related Expressions add_library(lib1 ...) add_library(lib2 ...) - target_link_libraries(lib2 PUBLIC $) + target_link_libraries(lib2 PUBLIC "$") add_library(lib3 ...) target_link_libraries(lib3 PRIVATE lib1 lib2) diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 5db622c..b38f56c 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -437,11 +437,11 @@ Variables that Control the Build /variable/CMAKE_LANG_CPPCHECK /variable/CMAKE_LANG_CPPLINT /variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE + /variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE + /variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE_SUPPORTED /variable/CMAKE_LANG_LINKER_LAUNCHER /variable/CMAKE_LANG_LINK_LIBRARY_FILE_FLAG /variable/CMAKE_LANG_LINK_LIBRARY_FLAG - /variable/CMAKE_LANG_LINK_USING_FEATURE - /variable/CMAKE_LANG_LINK_USING_FEATURE_SUPPORTED /variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG /variable/CMAKE_LANG_VISIBILITY_PRESET /variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY @@ -452,8 +452,8 @@ Variables that Control the Build /variable/CMAKE_LINK_INTERFACE_LIBRARIES /variable/CMAKE_LINK_LIBRARY_FILE_FLAG /variable/CMAKE_LINK_LIBRARY_FLAG - /variable/CMAKE_LINK_USING_FEATURE - /variable/CMAKE_LINK_USING_FEATURE_SUPPORTED + /variable/CMAKE_LINK_LIBRARY_USING_FEATURE + /variable/CMAKE_LINK_LIBRARY_USING_FEATURE_SUPPORTED /variable/CMAKE_LINK_WHAT_YOU_USE /variable/CMAKE_LINK_WHAT_YOU_USE_CHECK /variable/CMAKE_MACOSX_BUNDLE diff --git a/Help/prop_tgt/LINK_LIBRARY_OVERRIDE.rst b/Help/prop_tgt/LINK_LIBRARY_OVERRIDE.rst index e9c76b0..81a2a4a 100644 --- a/Help/prop_tgt/LINK_LIBRARY_OVERRIDE.rst +++ b/Help/prop_tgt/LINK_LIBRARY_OVERRIDE.rst @@ -22,10 +22,10 @@ example: .. code-block:: cmake add_library(lib1 ...) - target_link_libraries(lib1 PUBLIC $) + target_link_libraries(lib1 PUBLIC "$") add_library(lib2 ...) - target_link_libraries(lib2 PUBLIC $) + target_link_libraries(lib2 PUBLIC "$") add_library(lib3 ...) target_link_libraries(lib3 PRIVATE lib1 lib2) @@ -50,5 +50,5 @@ See also :prop_tgt:`LINK_LIBRARY_OVERRIDE_` target property for a per linked target oriented approach to override features. For more information about features, see -:variable:`CMAKE__LINK_USING_` -and :variable:`CMAKE_LINK_USING_` variables. +:variable:`CMAKE__LINK_LIBRARY_USING_` +and :variable:`CMAKE_LINK_LIBRARY_USING_` variables. diff --git a/Help/prop_tgt/LINK_LIBRARY_OVERRIDE_LIBRARY.rst b/Help/prop_tgt/LINK_LIBRARY_OVERRIDE_LIBRARY.rst index 58141c9..112f614 100644 --- a/Help/prop_tgt/LINK_LIBRARY_OVERRIDE_LIBRARY.rst +++ b/Help/prop_tgt/LINK_LIBRARY_OVERRIDE_LIBRARY.rst @@ -14,10 +14,10 @@ This property takes a ``feature`` name which will be applied to the .. code-block:: cmake add_library(lib1 ...) - target_link_libraries(lib1 PUBLIC $) + target_link_libraries(lib1 PUBLIC "$") add_library(lib2 ...) - target_link_libraries(lib2 PUBLIC $) + target_link_libraries(lib2 PUBLIC "$") add_library(lib3 ...) target_link_libraries(lib3 PRIVATE lib1 lib2) @@ -41,5 +41,5 @@ This property takes precedence over :prop_tgt:`LINK_LIBRARY_OVERRIDE` target property. For more information about features, see -:variable:`CMAKE__LINK_USING_` -and :variable:`CMAKE_LINK_USING_` variables. +:variable:`CMAKE__LINK_LIBRARY_USING_` +and :variable:`CMAKE_LINK_LIBRARY_USING_` variables. diff --git a/Help/release/dev/Genex-LINK_LIBRARY.rst b/Help/release/dev/Genex-LINK_LIBRARY.rst index 3234acb..fe44dbc 100644 --- a/Help/release/dev/Genex-LINK_LIBRARY.rst +++ b/Help/release/dev/Genex-LINK_LIBRARY.rst @@ -3,9 +3,9 @@ Genex-LINK_LIBRARY * The :genex:`LINK_LIBRARY` generator expression was added to manage how libraries are specified during the link step. The variables - :variable:`CMAKE__LINK_USING_` and - :variable:`CMAKE_LINK_USING_` are used to define features usable by - the :genex:`LINK_LIBRARY` generator expression. Moreover, the + :variable:`CMAKE__LINK_LIBRARY_USING_` and + :variable:`CMAKE_LINK_LIBRARY_USING_` are used to define features + usable by the :genex:`LINK_LIBRARY` generator expression. Moreover, the :prop_tgt:`LINK_LIBRARY_OVERRIDE` and :prop_tgt:`LINK_LIBRARY_OVERRIDE_` target properties are available to resolve incompatible features. diff --git a/Help/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE.rst b/Help/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE.rst new file mode 100644 index 0000000..45b8aa8 --- /dev/null +++ b/Help/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE.rst @@ -0,0 +1,26 @@ +CMAKE__LINK_LIBRARY_USING_ +----------------------------------------- + +.. versionadded:: 3.24 + +This variable defines, for the specified ```` and the linker language +````, the expression expected by the linker when libraries are specified +using :genex:`LINK_LIBRARY` generator expression. + +.. note:: + + Feature names defined in all uppercase are reserved to CMake. + +See also the associated variable +:variable:`CMAKE__LINK_LIBRARY_USING__SUPPORTED` and +:variable:`CMAKE_LINK_LIBRARY_USING_` variable for the definition of +features independent from the link language. + +.. include:: CMAKE_LINK_LIBRARY_USING_FEATURE.txt + +Predefined Features +^^^^^^^^^^^^^^^^^^^ + +``CMake`` pre-defines some features of general interest: + +.. include:: LINK_LIBRARY_PREDEFINED_FEATURES.txt diff --git a/Help/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE_SUPPORTED.rst b/Help/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE_SUPPORTED.rst new file mode 100644 index 0000000..e595bc7 --- /dev/null +++ b/Help/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE_SUPPORTED.rst @@ -0,0 +1,13 @@ +CMAKE__LINK_LIBRARY_USING__SUPPORTED +--------------------------------------------------- + +.. versionadded:: 3.24 + +Set to ``TRUE`` if the ````, as defined by variable +:variable:`CMAKE__LINK_LIBRARY_USING_`, is supported for the +linker language ````. + +.. note:: + + This variable is evaluated before the more generic variable + :variable:`CMAKE_LINK_LIBRARY_USING__SUPPORTED`. diff --git a/Help/variable/CMAKE_LANG_LINK_USING_FEATURE.rst b/Help/variable/CMAKE_LANG_LINK_USING_FEATURE.rst deleted file mode 100644 index 9d7f87a..0000000 --- a/Help/variable/CMAKE_LANG_LINK_USING_FEATURE.rst +++ /dev/null @@ -1,26 +0,0 @@ -CMAKE__LINK_USING_ ---------------------------------- - -.. versionadded:: 3.24 - -This variable defines, for the specified ```` and the linker language -````, the expression expected by the linker when libraries are specified -using :genex:`LINK_LIBRARY` generator expression. - -.. note:: - - Feature names defined in all uppercase are reserved to CMake. - -See also the associated variable -:variable:`CMAKE__LINK_USING__SUPPORTED` and -:variable:`CMAKE_LINK_USING_` variable for the definition of features -independent from the link language. - -.. include:: CMAKE_LINK_USING_FEATURE.txt - -Predefined Features -^^^^^^^^^^^^^^^^^^^ - -``CMake`` pre-defines some features of general interest: - -.. include:: LINK_LIBRARY_PREDEFINED_FEATURES.txt diff --git a/Help/variable/CMAKE_LANG_LINK_USING_FEATURE_SUPPORTED.rst b/Help/variable/CMAKE_LANG_LINK_USING_FEATURE_SUPPORTED.rst deleted file mode 100644 index 5794b15..0000000 --- a/Help/variable/CMAKE_LANG_LINK_USING_FEATURE_SUPPORTED.rst +++ /dev/null @@ -1,13 +0,0 @@ -CMAKE__LINK_USING__SUPPORTED -------------------------------------------- - -.. versionadded:: 3.24 - -Set to ``TRUE`` if the ````, as defined by variable -:variable:`CMAKE__LINK_USING_`, is supported for the linker -language ````. - -.. note:: - - This variable is evaluated before the more generic variable - :variable:`CMAKE_LINK_USING__SUPPORTED`. diff --git a/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.rst b/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.rst new file mode 100644 index 0000000..eae60c5 --- /dev/null +++ b/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.rst @@ -0,0 +1,31 @@ +CMAKE_LINK_LIBRARY_USING_ +---------------------------------- + +.. versionadded:: 3.24 + +This variable defines, for the specified ``FEATURE``, the expression expected +by the linker, regardless the linker language, when libraries are specified +using :genex:`LINK_LIBRARY` generator expression. + +.. note:: + + Feature names defined in all uppercase are reserved to CMake. + +See also the associated variable +:variable:`CMAKE_LINK_LIBRARY_USING__SUPPORTED` and +:variable:`CMAKE__LINK_LIBRARY_USING_` variable for the +definition of features dependent from the link language. + +This variable will be used by :genex:`LINK_LIBRARY` generator expression if, +for the linker language, the variable +:variable:`CMAKE__LINK_LIBRARY_USING__SUPPORTED` is false or not +set. + +.. include:: CMAKE_LINK_LIBRARY_USING_FEATURE.txt + +Predefined Features +^^^^^^^^^^^^^^^^^^^ + +``CMake`` pre-defines some features of general interest: + +.. include:: LINK_LIBRARY_PREDEFINED_FEATURES.txt diff --git a/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt b/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt new file mode 100644 index 0000000..ad393b0 --- /dev/null +++ b/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.txt @@ -0,0 +1,112 @@ + +It can contain one or three elements. + +:: + + [] [] + +When ```` and/or ```` are specified, they encapsulate the list +of libraries. + +.. note:: + + Even if ```` and ```` are specified, there is not guarantee + that the list of specified libraries, as part of :genex:`LINK_LIBRARY` + generator expression, will be kept grouped. So, constructs like + ``start-group`` and ``end-group``, as supported by ``GNU ld``, cannot be + used. + +```` is used to specify the decoration for each +library. For that purpose, the patterns ````, ````, and +```` are available: + +* ```` is expanded to the library as computed by CMake. +* ```` is expanded to the same expression as if the library was + specified in the standard way. +* ```` is equivalent to ```` for CMake targets and is + expanded to the item specified by the user for external libraries. + +Moreover, it is possible to have different decorations for paths (CMake targets +and external libraries specified with absolute paths) and other items specified +by name. For that purpose, ``PATH{}`` and ``NAME{}`` wrappers can be used. + +For all three elements of this variable, the ``LINKER:`` prefix can be used: + + .. include:: ../command/LINK_OPTIONS_LINKER.txt + :start-line: 3 + +Examples +^^^^^^^^ + +Loading a whole static library +"""""""""""""""""""""""""""""" + +A common need is the capability to load a whole static library. This capability +is offered by various environments but with a specific syntax: + +.. code-block:: cmake + + set(CMAKE_C_LINK_LIBRARY_USING_whole_archive_SUPPORTED TRUE) + if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang") + set(CMAKE_C_LINK_LIBRARY_USING_whole_archive "-force_load ") + 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" + "" + "LINKER:--pop-state") + elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + set(CMAKE_C_LINK_LIBRARY_USING_whole_archive "/WHOLEARCHIVE:") + else() + # feature not yet supported for the other environments + set(CMAKE_C_LINK_LIBRARY_USING_whole_archive_SUPPORTED FALSE) + endif() + + add_library(lib1 STATIC ...) + + add_library(lib2 SHARED ...) + if(CMAKE_C_LINK_LIBRARY_USING_whole_archive_SUPPORTED) + target_link_libraries(lib2 PRIVATE + "$,libexternal.a,external>>") + else() + target_link_libraries(lib2 PRIVATE lib1 external) + endif() + +CMake will generate the following link expressions: + +* ``Clang``: ``-force_load /path/to/lib1.a -force_load libexternal.a`` +* ``GNU``: ``-Wl,--whole-archive /path/to/lib1.a -lexternal -Wl,--no-whole-archive`` +* ``MSVC``: ``/WHOLEARCHIVE:/path/to/lib1.lib /WHOLEARCHIVE:external.lib`` + +CMake will ensure, when possible, that ```` and ```` are +not repeated for each library. + +In case of ``Clang``, the pattern ```` is used because we need to +specify the library as defined by the user, not the name computed by CMake +(in that case ``external``). + +Linking a library as weak +""""""""""""""""""""""""" + +On MacOS, it is possible to link a library in weak mode (the library and all +references are marked as weak imports), but different flags must be used for a +library specified by path and by name. This constraint by be solved by using +``PATH{}`` and ``NAME{}`` wrappers: + +.. code-block:: cmake + + if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang") + set(CMAKE_LINK_LIBRARY_USING_weak_library + "PATH{-weak_library }NAME{LINKER:-weak-l}") + set(CMAKE_LINK_LIBRARY_USING_weak_library_SUPPORTED TRUE) + endif() + + add_library(lib SHARED ...) + add_executable(main ...) + if(CMAKE_LINK_LIBRARY_USING_weak_library_SUPPORTED) + target_link_libraries(main PRIVATE "$") + else() + target_link_libraries(main PRIVATE lib external) + endif() + +CMake will generate the following link expression: +``-weak_library /path/to/lib -Xlinker -weak-lexternal`` diff --git a/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE_SUPPORTED.rst b/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE_SUPPORTED.rst new file mode 100644 index 0000000..42b75fc --- /dev/null +++ b/Help/variable/CMAKE_LINK_LIBRARY_USING_FEATURE_SUPPORTED.rst @@ -0,0 +1,14 @@ +CMAKE_LINK_LIBRARY_USING__SUPPORTED +-------------------------------------------- + +.. versionadded:: 3.24 + +Set to ``TRUE`` if the ````, as defined by variable +:variable:`CMAKE_LINK_LIBRARY_USING_`, is supported regardless the +linker language. + +.. note:: + + This variable is evaluated if, and only if, the variable + :variable:`CMAKE__LINK_LIBRARY_USING__SUPPORTED` evaluates to + ``FALSE``. diff --git a/Help/variable/CMAKE_LINK_USING_FEATURE.rst b/Help/variable/CMAKE_LINK_USING_FEATURE.rst deleted file mode 100644 index 0c9cadc..0000000 --- a/Help/variable/CMAKE_LINK_USING_FEATURE.rst +++ /dev/null @@ -1,30 +0,0 @@ -CMAKE_LINK_USING_ --------------------------- - -.. versionadded:: 3.24 - -This variable defines, for the specified ``FEATURE``, the expression expected -by the linker, regardless the linker language, when libraries are specified -using :genex:`LINK_LIBRARY` generator expression. - -.. note:: - - Feature names defined in all uppercase are reserved to CMake. - -See also the associated variable -:variable:`CMAKE_LINK_USING__SUPPORTED` and -:variable:`CMAKE__LINK_USING_` variable for the definition of -features dependent from the link language. - -This variable will be used by :genex:`LINK_LIBRARY` generator expression if, -for the linker language, the variable -:variable:`CMAKE__LINK_USING__SUPPORTED` is false or not set. - -.. include:: CMAKE_LINK_USING_FEATURE.txt - -Predefined Features -^^^^^^^^^^^^^^^^^^^ - -``CMake`` pre-defines some features of general interest: - -.. include:: LINK_LIBRARY_PREDEFINED_FEATURES.txt diff --git a/Help/variable/CMAKE_LINK_USING_FEATURE.txt b/Help/variable/CMAKE_LINK_USING_FEATURE.txt deleted file mode 100644 index 92fc92d..0000000 --- a/Help/variable/CMAKE_LINK_USING_FEATURE.txt +++ /dev/null @@ -1,111 +0,0 @@ - -It can contain one or three elements. - -:: - - [] [] - -When ```` and/or ```` are specified, they encapsulate the list -of libraries. - -.. note:: - - Even if ```` and ```` are specified, there is not guarantee - that the list of specified libraries, as part of :genex:`LINK_LIBRARY` - generator expression, will be kept grouped. So, constructs like - ``start-group`` and ``end-group``, as supported by ``GNU ld``, cannot be - used. - -```` is used to specify the decoration for each -library. For that purpose, the patterns ````, ````, and -```` are available: - -* ```` is expanded to the library as computed by CMake. -* ```` is expanded to the same expression as if the library was - specified in the standard way. -* ```` is equivalent to ```` for CMake targets and is - expanded to the item specified by the user for external libraries. - -Moreover, it is possible to have different decorations for paths (CMake targets -and external libraries specified with absolute paths) and other items specified -by name. For that purpose, ``PATH{}`` and ``NAME{}`` wrappers can be used. - -For all three elements of this variable, the ``LINKER:`` prefix can be used: - - .. include:: ../command/LINK_OPTIONS_LINKER.txt - :start-line: 3 - -Examples -^^^^^^^^ - -Loading a whole static library -"""""""""""""""""""""""""""""" - -A common need is the capability to load a whole static library. This capability -is offered by various environments but with a specific syntax: - -.. code-block:: cmake - - set(CMAKE_C_LINK_USING_whole_archive_SUPPORTED TRUE) - if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang") - set(CMAKE_C_LINK_USING_whole_archive "-force_load ") - elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" - AND CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(CMAKE_C_LINK_USING_whole_archive "LINKER:--push-state,--whole-archive" - "" - "LINKER:--pop-state") - elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") - set(CMAKE_C_LINK_USING_whole_archive "/WHOLEARCHIVE:") - else() - # feature not yet supported for the other environments - set(CMAKE_C_LINK_USING_whole_archive_SUPPORTED FALSE) - endif() - - add_library(lib1 STATIC ...) - - add_library(lib2 SHARED ...) - if(CMAKE_C_LINK_USING_whole_archive_SUPPORTED) - target_link_libraries(lib2 PRIVATE - $,libexternal.a,external>>) - else() - target_link_libraries(lib2 PRIVATE lib1 external) - endif() - -CMake will generate the following link expressions: - -* ``Clang``: ``-force_load /path/to/lib1.a -force_load libexternal.a`` -* ``GNU``: ``-Wl,--whole-archive /path/to/lib1.a -lexternal -Wl,--no-whole-archive`` -* ``MSVC``: ``/WHOLEARCHIVE:/path/to/lib1.lib /WHOLEARCHIVE:external.lib`` - -CMake will ensure, when possible, that ```` and ```` are -not repeated for each library. - -In case of ``Clang``, the pattern ```` is used because we need to -specify the library as defined by the user, not the name computed by CMake -(in that case ``external``). - -Linking a library as weak -""""""""""""""""""""""""" - -On MacOS, it is possible to link a library in weak mode (the library and all -references are marked as weak imports), but different flags must be used for a -library specified by path and by name. This constraint by be solved by using -``PATH{}`` and ``NAME{}`` wrappers: - -.. code-block:: cmake - - if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang") - set(CMAKE_LINK_USING_weak_library "PATH{-weak_library }NAME{LINKER:-weak-l}") - set(CMAKE_LINK_USING_weak_library_SUPPORTED TRUE) - endif() - - add_library(lib SHARED ...) - add_executable(main ...) - if(CMAKE_LINK_USING_weak_library_SUPPORTED) - target_link_libraries(main PRIVATE $) - else() - target_link_libraries(main PRIVATE lib external) - endif() - -CMake will generate the following link expression: -``-weak_library /path/to/lib -Xlinker -weak-lexternal`` diff --git a/Help/variable/CMAKE_LINK_USING_FEATURE_SUPPORTED.rst b/Help/variable/CMAKE_LINK_USING_FEATURE_SUPPORTED.rst deleted file mode 100644 index 31c3108..0000000 --- a/Help/variable/CMAKE_LINK_USING_FEATURE_SUPPORTED.rst +++ /dev/null @@ -1,14 +0,0 @@ -CMAKE_LINK_USING__SUPPORTED ------------------------------------- - -.. versionadded:: 3.24 - -Set to ``TRUE`` if the ````, as defined by variable -:variable:`CMAKE_LINK_USING_`, is supported regardless the linker -language. - -.. note:: - - This variable is evaluated if, and only if, the variable - :variable:`CMAKE__LINK_USING__SUPPORTED` evaluates to - ``FALSE``. diff --git a/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt b/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt index d4fdf76..82c406a 100644 --- a/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt +++ b/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt @@ -23,9 +23,11 @@ compatible with it. linker option ``-weak_framework``). Features for framework linking have a special handling in ``CMake``: the -framework can be specified as a ``CMake`` framework target or file path. In -the later case, if the path includes a directory part, this one will be -specified as framework search path at link step. +framework can be specified as a ``CMake`` framework target or file path. In the +first case, the target must have the :prop_tgt:`FRAMEWORK` target property set +as ``TRUE`` to enable framework handling. In the later case, if the path +includes a directory part, this one will be specified as framework search path +at link step. .. code-block:: cmake diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 9ae68c4..6e75fac 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -28,7 +28,7 @@ set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") # default option to link a library # This feature is intended to be used in LINK_LIBRARY_OVERRIDE and # LINK_LIBRARY_OVERRIDE_ target properties -set(CMAKE_LINK_USING_DEFAULT_SUPPORTED TRUE) +set(CMAKE_LINK_LIBRARY_USING_DEFAULT_SUPPORTED TRUE) set(CMAKE_AUTOGEN_ORIGIN_DEPENDS ON) set(CMAKE_AUTOMOC_COMPILER_PREDEFINES ON) diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake index 44eb35f..e85ec67 100644 --- a/Modules/Compiler/Clang-CUDA.cmake +++ b/Modules/Compiler/Clang-CUDA.cmake @@ -41,15 +41,15 @@ endif() if(APPLE) # Defines host link features for frameworks - set(CMAKE_CUDA_LINK_USING_FRAMEWORK "LINKER:-framework,") - set(CMAKE_CUDA_LINK_USING_FRAMEWORK_SUPPORTED TRUE) + set(CMAKE_CUDA_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,") + set(CMAKE_CUDA_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE) - set(CMAKE_CUDA_LINK_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,") - set(CMAKE_CUDA_LINK_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE) + set(CMAKE_CUDA_LINK_LIBRARY_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,") + set(CMAKE_CUDA_LINK_LIBRARY_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE) - set(CMAKE_CUDA_LINK_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,") - set(CMAKE_CUDA_LINK_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE) + set(CMAKE_CUDA_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,") + set(CMAKE_CUDA_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE) - set(CMAKE_CUDA_LINK_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,") - set(CMAKE_CUDA_LINK_USING_WEAK_FRAMEWORK_SUPPORTED TRUE) + set(CMAKE_CUDA_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,") + set(CMAKE_CUDA_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE) endif() diff --git a/Modules/Platform/Apple-Apple-Swift.cmake b/Modules/Platform/Apple-Apple-Swift.cmake index 255411e..9f604e8 100644 --- a/Modules/Platform/Apple-Apple-Swift.cmake +++ b/Modules/Platform/Apple-Apple-Swift.cmake @@ -2,14 +2,14 @@ set(CMAKE_Swift_SYSROOT_FLAG "-sdk") # Defines host link features for frameworks -set(CMAKE_Swift_LINK_USING_FRAMEWORK "LINKER:-framework,") -set(CMAKE_Swift_LINK_USING_FRAMEWORK_SUPPORTED TRUE) +set(CMAKE_Swift_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,") +set(CMAKE_Swift_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE) -set(CMAKE_Swift_LINK_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,") -set(CMAKE_Swift_LINK_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE) +set(CMAKE_Swift_LINK_LIBRARY_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,") +set(CMAKE_Swift_LINK_LIBRARY_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE) -set(CMAKE_Swift_LINK_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,") -set(CMAKE_Swift_LINK_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE) +set(CMAKE_Swift_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,") +set(CMAKE_Swift_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE) -set(CMAKE_Swift_LINK_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,") -set(CMAKE_Swift_LINK_USING_WEAK_FRAMEWORK_SUPPORTED TRUE) +set(CMAKE_Swift_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,") +set(CMAKE_Swift_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE) diff --git a/Modules/Platform/Apple-NVIDIA-CUDA.cmake b/Modules/Platform/Apple-NVIDIA-CUDA.cmake index ba669e1..0b8bbd9 100644 --- a/Modules/Platform/Apple-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Apple-NVIDIA-CUDA.cmake @@ -20,14 +20,14 @@ set(CMAKE_CUDA_CREATE_SHARED_MODULE " ") -set(CMAKE_CUDA_LINK_USING_FRAMEWORK_SUPPORTED TRUE) +set(CMAKE_CUDA_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,") +set(CMAKE_CUDA_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE) -set(CMAKE_CUDA_LINK_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,") -set(CMAKE_CUDA_LINK_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE) +set(CMAKE_CUDA_LINK_LIBRARY_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,") +set(CMAKE_CUDA_LINK_LIBRARY_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE) -set(CMAKE_CUDA_LINK_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,") -set(CMAKE_CUDA_LINK_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE) +set(CMAKE_CUDA_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,") +set(CMAKE_CUDA_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE) -set(CMAKE_CUDA_LINK_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,") -set(CMAKE_CUDA_LINK_USING_WEAK_FRAMEWORK_SUPPORTED TRUE) +set(CMAKE_CUDA_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,") +set(CMAKE_CUDA_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index d7b615c..74411e9 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -108,17 +108,17 @@ foreach(lang C CXX Fortran OBJC OBJCXX) set(CMAKE_${lang}_FRAMEWORK_SEARCH_FLAG -F) # Defines link features for frameworks - set(CMAKE_${lang}_LINK_USING_FRAMEWORK "LINKER:-framework,") - set(CMAKE_${lang}_LINK_USING_FRAMEWORK_SUPPORTED TRUE) + set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,") + set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE) - set(CMAKE_${lang}_LINK_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,") - set(CMAKE_${lang}_LINK_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE) + set(CMAKE_${lang}_LINK_LIBRARY_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,") + set(CMAKE_${lang}_LINK_LIBRARY_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE) - set(CMAKE_${lang}_LINK_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,") - set(CMAKE_${lang}_LINK_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE) + set(CMAKE_${lang}_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,") + set(CMAKE_${lang}_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE) - set(CMAKE_${lang}_LINK_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,") - set(CMAKE_${lang}_LINK_USING_WEAK_FRAMEWORK_SUPPORTED TRUE) + set(CMAKE_${lang}_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,") + set(CMAKE_${lang}_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE) endforeach() # default to searching for frameworks first diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index e6073cb..d22a4f2 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -192,13 +192,14 @@ inline std::string ExtractFeature(std::string const& item) bool IsFeatureSupported(cmMakefile* makefile, std::string const& linkLanguage, std::string const& feature) { - auto featureSupported = - cmStrCat("CMAKE_", linkLanguage, "_LINK_USING_", feature, "_SUPPORTED"); + auto featureSupported = cmStrCat( + "CMAKE_", linkLanguage, "_LINK_LIBRARY_USING_", feature, "_SUPPORTED"); if (makefile->GetDefinition(featureSupported).IsOn()) { return true; } - featureSupported = cmStrCat("CMAKE_LINK_USING_", feature, "_SUPPORTED"); + featureSupported = + cmStrCat("CMAKE_LINK_LIBRARY_USING_", feature, "_SUPPORTED"); return makefile->GetDefinition(featureSupported).IsOn(); } } @@ -650,9 +651,9 @@ void cmComputeLinkDepends::AddLinkEntries(int depender_index, feature, "', which is undefined or unsupported.\nDid you miss to " "define it by setting variables \"CMAKE_", - this->LinkLanguage, "_LINK_USING_", feature, - "\" and \"CMAKE_", this->LinkLanguage, "_LINK_USING_", - feature, "_SUPPORTED\"?"), + this->LinkLanguage, "_LINK_LIBRARY_USING_", feature, + "\" and \"CMAKE_", this->LinkLanguage, + "_LINK_LIBRARY_USING_", feature, "_SUPPORTED\"?"), this->Target->GetBacktrace()); } } diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index cf8c9a1..9df2044 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -674,11 +674,11 @@ bool cmComputeLinkInformation::AddLibraryFeature(std::string const& feature) } auto featureName = - cmStrCat("CMAKE_", this->LinkLanguage, "_LINK_USING_", feature); + cmStrCat("CMAKE_", this->LinkLanguage, "_LINK_LIBRARY_USING_", feature); cmValue featureSupported = this->Makefile->GetDefinition(cmStrCat(featureName, "_SUPPORTED")); if (!featureSupported.IsOn()) { - featureName = cmStrCat("CMAKE_LINK_USING_", feature); + featureName = cmStrCat("CMAKE_LINK_LIBRARY_USING_", feature); featureSupported = this->Makefile->GetDefinition(cmStrCat(featureName, "_SUPPORTED")); } diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2.cmake index 15b5ca0..2c9efce 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat_SUPPORTED TRUE) add_library(dep SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3-stderr.txt index 69963fe..48cf51e 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3-stderr.txt @@ -1,5 +1,5 @@ CMake Error at bad-feature3.cmake:[0-9]+ \(add_library\): - Feature 'feat', specified by variable 'CMAKE_C_LINK_USING_feat', is + Feature 'feat', specified by variable 'CMAKE_C_LINK_LIBRARY_USING_feat', is malformed \("", "", or "" patterns are missing\) and cannot be used to link target 'lib'. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3.cmake index 7960465..dab6a64 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3.cmake @@ -1,7 +1,7 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat "") +set(CMAKE_C_LINK_LIBRARY_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat "") add_library(dep SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4-stderr.txt index 7385115..c074dd0 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4-stderr.txt @@ -1,5 +1,5 @@ CMake Error at bad-feature4.cmake:[0-9]+ \(add_library\): - Feature 'feat', specified by variable 'CMAKE_C_LINK_USING_feat', is + Feature 'feat', specified by variable 'CMAKE_C_LINK_LIBRARY_USING_feat', is malformed \("", "", or "" patterns are missing\) and cannot be used to link target 'lib'. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4.cmake index b40cfaf..6942f7c 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4.cmake @@ -1,7 +1,7 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat "-opt") +set(CMAKE_C_LINK_LIBRARY_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat "-opt") add_library(dep SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5-stderr.txt index 9894577..6604307 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5-stderr.txt @@ -1,5 +1,5 @@ CMake Error at bad-feature5.cmake:[0-9]+ \(add_library\): - Feature 'feat', specified by variable 'CMAKE_C_LINK_USING_feat', is + Feature 'feat', specified by variable 'CMAKE_C_LINK_LIBRARY_USING_feat', is malformed \(wrong number of elements\) and cannot be used to link target 'lib'. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5.cmake index 8ce1ecf..d0a827a 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5.cmake @@ -1,7 +1,7 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat "-prefix" "") +set(CMAKE_C_LINK_LIBRARY_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat "-prefix" "") add_library(dep SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6-stderr.txt index d8d0e19..9de4ffa 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6-stderr.txt @@ -1,5 +1,5 @@ CMake Error at bad-feature6.cmake:[0-9]+ \(add_library\): - Feature 'feat', specified by variable 'CMAKE_C_LINK_USING_feat', is + Feature 'feat', specified by variable 'CMAKE_C_LINK_LIBRARY_USING_feat', is malformed \("", "", or "" patterns are missing for "PATH{}" alternative\) and cannot be used to link target 'lib'. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6.cmake index 7b72ad5..04a50f8 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6.cmake @@ -1,7 +1,7 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat "PATH{}NAME{}") +set(CMAKE_C_LINK_LIBRARY_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat "PATH{}NAME{}") add_library(dep SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7-stderr.txt index 2a498cd..9ea9936 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7-stderr.txt @@ -1,5 +1,5 @@ CMake Error at bad-feature7.cmake:[0-9]+ \(add_library\): - Feature 'feat', specified by variable 'CMAKE_C_LINK_USING_feat', is + Feature 'feat', specified by variable 'CMAKE_C_LINK_LIBRARY_USING_feat', is malformed \("", "", or "" patterns are missing for "NAME{}" alternative\) and cannot be used to link target 'lib'. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7.cmake index 173f86c..9659811 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7.cmake @@ -1,7 +1,7 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat "NAME{}PATH{}") +set(CMAKE_C_LINK_LIBRARY_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat "NAME{}PATH{}") add_library(dep SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/compatible-features.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/compatible-features.cmake index 2579a5f..fb88e36 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/compatible-features.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/compatible-features.cmake @@ -1,10 +1,10 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat1 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat1 "") -set(CMAKE_C_LINK_USING_feat2_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat2 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat2_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat2 "") add_library(dep1 SHARED empty.c) @@ -15,7 +15,7 @@ add_library(dep3 SHARED empty.c) target_link_libraries(dep3 PUBLIC dep2) add_library(lib1 SHARED empty.c) -target_link_libraries(lib1 PRIVATE $) +target_link_libraries(lib1 PRIVATE "$") add_library(lib2 SHARED empty.c) -target_link_libraries(lib2 PRIVATE $) +target_link_libraries(lib2 PRIVATE "$") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported.cmake index 0666227..0d952c2 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported.cmake @@ -1,7 +1,7 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat_SUPPORTED FALSE) -set(CMAKE_C_LINK_USING_feat "") +set(CMAKE_C_LINK_LIBRARY_USING_feat_SUPPORTED FALSE) +set(CMAKE_C_LINK_LIBRARY_USING_feat "") add_library(dep SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features1.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features1.cmake index d96b214..c230c4f 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features1.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features1.cmake @@ -1,10 +1,10 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat1 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat1 "") -set(CMAKE_C_LINK_USING_feat2_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat2 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat2_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat2 "") add_library(dep1 SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features2.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features2.cmake index 1845fdb..d204ebd 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features2.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features2.cmake @@ -1,10 +1,10 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat1 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat1 "") -set(CMAKE_C_LINK_USING_feat2_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat2 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat2_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat2 "") add_library(dep1 SHARED empty.c) @@ -12,4 +12,4 @@ add_library(dep2 SHARED empty.c) target_link_libraries(dep2 PUBLIC dep1) add_library(lib SHARED empty.c) -target_link_libraries(lib PRIVATE $) +target_link_libraries(lib PRIVATE "$") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features3.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features3.cmake index 1198d91..bf79e11 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features3.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features3.cmake @@ -1,15 +1,15 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat1 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat1 "") -set(CMAKE_C_LINK_USING_feat2_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat2 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat2_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat2 "") add_library(dep1 SHARED empty.c) add_library(dep2 SHARED empty.c) -target_link_libraries(dep2 PUBLIC $) +target_link_libraries(dep2 PUBLIC "$") add_library(lib SHARED empty.c) target_link_libraries(lib PRIVATE dep1 dep2) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/library-ignored.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/library-ignored.cmake index e000b97..a888bb8 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/library-ignored.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/library-ignored.cmake @@ -1,7 +1,7 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat "") +set(CMAKE_C_LINK_LIBRARY_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat "") add_library(dep OBJECT empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-compatible-features.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-compatible-features.cmake index d3b04e8..561aa09 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-compatible-features.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-compatible-features.cmake @@ -1,7 +1,7 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat1 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat1 "") add_library(dep1 SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features.cmake index 8565fa9..746638e 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features.cmake @@ -1,10 +1,10 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat1 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat1 "") -set(CMAKE_C_LINK_USING_feat2_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat2 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat2_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat2 "") add_library(dep1 SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets.cmake index e29ad6c..8cec0c3 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets.cmake @@ -1,7 +1,7 @@ enable_language(C) -set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat1 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat1 "") set(CMAKE_LINK_LIBRARIES_ONLY_TARGETS 1) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/override-features3.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/override-features3.cmake index 7f010fd..a1437e6 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/override-features3.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/override-features3.cmake @@ -1,7 +1,7 @@ include(incompatible-features1.cmake) -set(CMAKE_C_LINK_USING_feat3_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat3 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat3_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat3 "") set_property(TARGET lib PROPERTY LINK_LIBRARY_OVERRIDE "feat3,dep1") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/override-features4.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/override-features4.cmake index 405cc8a..f34f745 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/override-features4.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/override-features4.cmake @@ -2,8 +2,8 @@ include(incompatible-features1.cmake) -set(CMAKE_C_LINK_USING_feat3_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat3 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat3_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat3 "") set_property(TARGET lib PROPERTY LINK_LIBRARY_OVERRIDE "feat3,dep1") set_property(TARGET lib PROPERTY LINK_LIBRARY_OVERRIDE_dep1 feat1) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options.cmake index 800124c..a989a53 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options.cmake @@ -1,4 +1,4 @@ enable_language(C) add_library(empty SHARED empty.c) -target_link_options(empty PRIVATE $) +target_link_options(empty PRIVATE "$") diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY.cmake index ced689e..1581611 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY.cmake @@ -12,28 +12,28 @@ endif() add_library(base1 SHARED base.c) add_library(base2 SHARED base.c) -set(CMAKE_C_LINK_USING_feat1 "--LIBFLAG") -set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat1 "--LIBFLAG") +set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat1_1 "--LIBFLAG_C") -set(CMAKE_C_LINK_USING_feat1_1_SUPPORTED FALSE) -set(CMAKE_LINK_USING_feat1_1 "--LIBFLAG") -set(CMAKE_LINK_USING_feat1_1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat1_1 "--LIBFLAG_C") +set(CMAKE_C_LINK_LIBRARY_USING_feat1_1_SUPPORTED FALSE) +set(CMAKE_LINK_LIBRARY_USING_feat1_1 "--LIBFLAG") +set(CMAKE_LINK_LIBRARY_USING_feat1_1_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat2 "--PREFIXGROUP" "--LIBGROUP" "--SUFFIXGROUP") -set(CMAKE_C_LINK_USING_feat2_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat2 "--PREFIXGROUP" "--LIBGROUP" "--SUFFIXGROUP") +set(CMAKE_C_LINK_LIBRARY_USING_feat2_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat3 "--PREFIXGROUP" "" "--SUFFIXGROUP") -set(CMAKE_C_LINK_USING_feat3_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat3 "--PREFIXGROUP" "" "--SUFFIXGROUP") +set(CMAKE_C_LINK_LIBRARY_USING_feat3_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat4 "--PREFIXGROUP" "--LIBFLAG --ITEMFLAG" "--SUFFIXGROUP") -set(CMAKE_C_LINK_USING_feat4_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat4 "--PREFIXGROUP" "--LIBFLAG --ITEMFLAG" "--SUFFIXGROUP") +set(CMAKE_C_LINK_LIBRARY_USING_feat4_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat5 "--PREFIXGROUP" "PATH{--LIBFLAG}NAME{--ITEMFLAG}" "--SUFFIXGROUP") -set(CMAKE_C_LINK_USING_feat5_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat5 "--PREFIXGROUP" "PATH{--LIBFLAG}NAME{--ITEMFLAG}" "--SUFFIXGROUP") +set(CMAKE_C_LINK_LIBRARY_USING_feat5_SUPPORTED TRUE) -set(CMAKE_C_LINK_USING_feat6 "") -set(CMAKE_C_LINK_USING_feat6_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat6 "") +set(CMAKE_C_LINK_LIBRARY_USING_feat6_SUPPORTED TRUE) add_library(LinkLibrary_simple1 SHARED lib.c) @@ -77,28 +77,28 @@ target_link_libraries(LinkLibrary_mix_features2 PRIVATE "$ other2) +target_link_libraries(LinkLibrary_mix_features3 PRIVATE base2 "$" other2) # testing LINK_LIBRARY_OVERRIDE property add_library(LinkLibrary_override_features1 SHARED lib.c) -target_link_libraries(LinkLibrary_override_features1 PRIVATE $) +target_link_libraries(LinkLibrary_override_features1 PRIVATE "$") set_property(TARGET LinkLibrary_override_features1 PROPERTY LINK_LIBRARY_OVERRIDE "feat1,base1") add_library(LinkLibrary_override_features2 SHARED lib.c) -target_link_libraries(LinkLibrary_override_features2 PRIVATE $) +target_link_libraries(LinkLibrary_override_features2 PRIVATE "$") set_property(TARGET LinkLibrary_override_features2 PROPERTY LINK_LIBRARY_OVERRIDE "feat2,base1,other1") add_library(LinkLibrary_override_with_default SHARED lib.c) -target_link_libraries(LinkLibrary_override_with_default PRIVATE $) +target_link_libraries(LinkLibrary_override_with_default PRIVATE "$") set_property(TARGET LinkLibrary_override_with_default PROPERTY LINK_LIBRARY_OVERRIDE "$<$:DEFAULT,base1,other1>") # testing LINK_LIBRARY_OVERRIDE_ property add_library(LinkLibrary_override_features3 SHARED lib.c) -target_link_libraries(LinkLibrary_override_features3 PRIVATE $) +target_link_libraries(LinkLibrary_override_features3 PRIVATE "$") set_property(TARGET LinkLibrary_override_features3 PROPERTY LINK_LIBRARY_OVERRIDE_base1 feat1) add_library(LinkLibrary_override_features4 SHARED lib.c) -target_link_libraries(LinkLibrary_override_features4 PRIVATE $) +target_link_libraries(LinkLibrary_override_features4 PRIVATE "$") set_property(TARGET LinkLibrary_override_features4 PROPERTY LINK_LIBRARY_OVERRIDE "feat3,base1,other1") set_property(TARGET LinkLibrary_override_features4 PROPERTY LINK_LIBRARY_OVERRIDE_base1 feat2) set_property(TARGET LinkLibrary_override_features4 PROPERTY LINK_LIBRARY_OVERRIDE_other1 feat2) diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/imported-target-stdout.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/imported-target-stdout.txt index b3a86cc..981376a 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/imported-target-stdout.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/imported-target-stdout.txt @@ -4,8 +4,8 @@ CMake Warning \(dev\) at imported-target.cmake:[0-9]+ \(add_library\): unsupported. Did you miss to define it by setting variables - "CMAKE_C_LINK_USING_whole_archive" and - "CMAKE_C_LINK_USING_whole_archive_SUPPORTED"\? + "CMAKE_C_LINK_LIBRARY_USING_whole_archive" and + "CMAKE_C_LINK_LIBRARY_USING_whole_archive_SUPPORTED"\? Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/weak_library.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/weak_library.cmake index 135326e..45b4f66 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/weak_library.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/weak_library.cmake @@ -2,11 +2,11 @@ enable_language(C) if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang") - set(CMAKE_LINK_USING_weak_library "PATH{-weak_library }NAME{LINKER:-weak-l}") - set(CMAKE_LINK_USING_weak_library_SUPPORTED TRUE) + set(CMAKE_LINK_LIBRARY_USING_weak_library "PATH{-weak_library }NAME{LINKER:-weak-l}") + set(CMAKE_LINK_LIBRARY_USING_weak_library_SUPPORTED TRUE) else() # feature not yet supported for the other environments - set(CMAKE_LINK_USING_whole_library_SUPPORTED FALSE) + set(CMAKE_LINK_LIBRARY_USING_whole_library_SUPPORTED FALSE) endif() add_library(lib SHARED base.c lib.c unref.c) diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/whole_archive.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/whole_archive.cmake index 5214565..93082a4 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/whole_archive.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/whole_archive.cmake @@ -1,27 +1,27 @@ enable_language(C) -set(CMAKE_C_LINK_USING_whole_archive_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_whole_archive_SUPPORTED TRUE) if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang") - set(CMAKE_C_LINK_USING_whole_archive "-force_load ") + set(CMAKE_C_LINK_LIBRARY_USING_whole_archive "-force_load ") elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") 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_C_LINK_USING_whole_archive "LINKER:--push-state,--whole-archive" - "" - "LINKER:--pop-state") + set(CMAKE_C_LINK_LIBRARY_USING_whole_archive "LINKER:--push-state,--whole-archive" + "" + "LINKER:--pop-state") else() - set(CMAKE_C_LINK_USING_whole_archive "LINKER:--whole-archive" - "" - "LINKER:--no-whole-archive") + set(CMAKE_C_LINK_LIBRARY_USING_whole_archive "LINKER:--whole-archive" + "" + "LINKER:--no-whole-archive") endif() elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") - set(CMAKE_C_LINK_USING_whole_archive "/WHOLEARCHIVE:") + set(CMAKE_C_LINK_LIBRARY_USING_whole_archive "/WHOLEARCHIVE:") else() # feature not yet supported for the other environments - set(CMAKE_C_LINK_USING_whole_archive_SUPPORTED FALSE) + set(CMAKE_C_LINK_LIBRARY_USING_whole_archive_SUPPORTED FALSE) endif() add_library(base STATIC base.c unref.c) -- cgit v0.12