Merge topic 'link-feature-attributes-stabilization' into release-3.30
576567f028
Link feature attributes: stabilization5617c34c31
Libraries processing: update configuration wording Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9607
This commit is contained in:
commit
c3046ea289
@ -467,7 +467,7 @@ Variables that Control the Build
|
||||
/variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE
|
||||
/variable/CMAKE_LANG_LINK_GROUP_USING_FEATURE
|
||||
/variable/CMAKE_LANG_LINK_GROUP_USING_FEATURE_SUPPORTED
|
||||
/variable/CMAKE_LANG_LINK_LIBRARY_FEATURE_PROPERTIES
|
||||
/variable/CMAKE_LANG_LINK_LIBRARY_FEATURE_ATTRIBUTES
|
||||
/variable/CMAKE_LANG_LINK_LIBRARY_FILE_FLAG
|
||||
/variable/CMAKE_LANG_LINK_LIBRARY_FLAG
|
||||
/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE
|
||||
@ -486,7 +486,7 @@ Variables that Control the Build
|
||||
/variable/CMAKE_LINK_GROUP_USING_FEATURE
|
||||
/variable/CMAKE_LINK_GROUP_USING_FEATURE_SUPPORTED
|
||||
/variable/CMAKE_LINK_INTERFACE_LIBRARIES
|
||||
/variable/CMAKE_LINK_LIBRARY_FEATURE_PROPERTIES
|
||||
/variable/CMAKE_LINK_LIBRARY_FEATURE_ATTRIBUTES
|
||||
/variable/CMAKE_LINK_LIBRARY_FILE_FLAG
|
||||
/variable/CMAKE_LINK_LIBRARY_FLAG
|
||||
/variable/CMAKE_LINK_LIBRARY_USING_FEATURE
|
||||
|
@ -148,9 +148,9 @@ Generator Expressions
|
||||
associated :variable:`CMAKE_<LANG>_COMPILER_FRONTEND_VARIANT` variables.
|
||||
|
||||
* Link features, as used with the :genex:`LINK_LIBRARY` generator expression,
|
||||
gained the ability to have properties that describe their behavior by
|
||||
specifying the :variable:`CMAKE_LINK_LIBRARY_<FEATURE>_PROPERTIES` or
|
||||
:variable:`CMAKE_<LANG>_LINK_LIBRARY_<FEATURE>_PROPERTIES` variables.
|
||||
gained the ability to have attributes that describe their behavior by
|
||||
specifying the :variable:`CMAKE_LINK_LIBRARY_<FEATURE>_ATTRIBUTES` or
|
||||
:variable:`CMAKE_<LANG>_LINK_LIBRARY_<FEATURE>_ATTRIBUTES` variables.
|
||||
|
||||
* The :genex:`QUOTE` generator expression was added to evaluate to ``"``.
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
CMAKE_<LANG>_LINK_LIBRARY_<FEATURE>_PROPERTIES
|
||||
CMAKE_<LANG>_LINK_LIBRARY_<FEATURE>_ATTRIBUTES
|
||||
----------------------------------------------
|
||||
|
||||
.. versionadded:: 3.30
|
||||
|
||||
This variable defines the semantics of the specified link library ``<FEATURE>``
|
||||
when linking with the link language ``<LANG>``. It takes precedence over
|
||||
:variable:`CMAKE_LINK_LIBRARY_<FEATURE>_PROPERTIES` if that variable is also
|
||||
:variable:`CMAKE_LINK_LIBRARY_<FEATURE>_ATTRIBUTES` if that variable is also
|
||||
defined for the same ``<FEATURE>``, but otherwise has similar effects.
|
||||
See :variable:`CMAKE_LINK_LIBRARY_<FEATURE>_PROPERTIES` for further details.
|
||||
See :variable:`CMAKE_LINK_LIBRARY_<FEATURE>_ATTRIBUTES` for further details.
|
@ -1,4 +1,4 @@
|
||||
CMAKE_LINK_LIBRARY_<FEATURE>_PROPERTIES
|
||||
CMAKE_LINK_LIBRARY_<FEATURE>_ATTRIBUTES
|
||||
---------------------------------------
|
||||
|
||||
.. versionadded:: 3.30
|
||||
@ -17,28 +17,29 @@ The :variable:`CMAKE_<LANG>_LINK_LIBRARY_USING_<FEATURE>_SUPPORTED` and
|
||||
control whether the ``<FEATURE>`` is available at all.
|
||||
|
||||
When linking for a particular language ``<LANG>``,
|
||||
``CMAKE_LINK_LIBRARY_<FEATURE>_PROPERTIES`` is ignored if the
|
||||
:variable:`CMAKE_<LANG>_LINK_LIBRARY_<FEATURE>_PROPERTIES` variable is also
|
||||
``CMAKE_LINK_LIBRARY_<FEATURE>_ATTRIBUTES`` is ignored if the
|
||||
:variable:`CMAKE_<LANG>_LINK_LIBRARY_<FEATURE>_ATTRIBUTES` variable is also
|
||||
defined for the same ``<FEATURE>``.
|
||||
|
||||
The value of ``CMAKE_LINK_LIBRARY_<FEATURE>_PROPERTIES`` and
|
||||
:variable:`CMAKE_<LANG>_LINK_LIBRARY_<FEATURE>_PROPERTIES` at the end of the
|
||||
The value of ``CMAKE_LINK_LIBRARY_<FEATURE>_ATTRIBUTES`` and
|
||||
:variable:`CMAKE_<LANG>_LINK_LIBRARY_<FEATURE>_ATTRIBUTES` at the end of the
|
||||
directory scope in which a target is defined is what matters.
|
||||
|
||||
Feature Properties Definition
|
||||
Feature Attributes Definition
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
A feature properties definition is a
|
||||
:ref:`semicolon-separated list <CMake Language Lists>` of ``property=value(s)``
|
||||
items. If a property has multiple values, those values must be comma-separated.
|
||||
A feature attributes definition is a
|
||||
:ref:`semicolon-separated list <CMake Language Lists>` of
|
||||
``attribute=value(s)`` items. If an attribute has multiple values, those values
|
||||
must be comma-separated.
|
||||
|
||||
The following properties are supported:
|
||||
The following attributes are supported:
|
||||
|
||||
``LIBRARY_TYPE=<library-type-list>``
|
||||
Specify the library types supported by the feature. Supported values are:
|
||||
``STATIC``, ``SHARED``, ``MODULE``, and ``EXECUTABLE``.
|
||||
|
||||
If this property is not specified, the default is
|
||||
If this attribute is not specified, the default is
|
||||
``LIBRARY_TYPE=STATIC,SHARED,MODULE,EXECUTABLE``.
|
||||
|
||||
If the feature is used with an unsupported library type, CMake will emit a
|
||||
@ -51,9 +52,9 @@ The following properties are supported:
|
||||
:prop_tgt:`LINK_LIBRARY_OVERRIDE_<LIBRARY>` target property definitions,
|
||||
if defined.
|
||||
|
||||
If this property is not specified, the default is an empty list.
|
||||
If this attribute is not specified, the default is an empty list.
|
||||
|
||||
``UNICITY=YES|NO|DEFAULT``
|
||||
``DEDUPLICATION=YES|NO|DEFAULT``
|
||||
Specify the de-duplication strategy for a library using this feature.
|
||||
|
||||
``YES``
|
||||
@ -67,7 +68,7 @@ The following properties are supported:
|
||||
``DEFAULT``
|
||||
Let CMake determine a de-duplication strategy automatically.
|
||||
|
||||
If this property is not specified, ``DEFAULT`` will be used.
|
||||
If this attribute is not specified, ``DEFAULT`` will be used.
|
||||
|
||||
Example
|
||||
^^^^^^^
|
||||
@ -75,14 +76,14 @@ Example
|
||||
A common need is the loading of a full archive as part of the creation of a
|
||||
shared library. The built-in ``WHOLE_ARCHIVE`` feature can be used for that
|
||||
purpose. The implementation of that built-in feature sets the following
|
||||
link library feature properties:
|
||||
link library feature attributes:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES
|
||||
LIBRARY_TYPE=STATIC
|
||||
OVERRIDE=DEFAULT
|
||||
UNICITY=YES
|
||||
DEDUPLICATION=YES
|
||||
)
|
||||
|
||||
``LIBRARY_TYPE=STATIC``
|
||||
@ -92,7 +93,7 @@ link library feature properties:
|
||||
because they are compatible and enhance the user's experience: standard
|
||||
library specification and ``$<LINK_LIBRARY:WHOLE_ARCHIVE>`` can be used
|
||||
freely.
|
||||
``UNICITY=YES``
|
||||
``DEDUPLICATION=YES``
|
||||
When this feature is used, the linker loads all symbols from the static
|
||||
library, so there is no need to repeat the library on the linker
|
||||
command line.
|
@ -3,8 +3,8 @@ and underscores. Feature names defined in all uppercase are reserved for
|
||||
CMake's own built-in features (see `Predefined Features`_ further below).
|
||||
|
||||
Some aspects of feature behavior can be defined by the
|
||||
:variable:`CMAKE_<LANG>_LINK_LIBRARY_<FEATURE>_PROPERTIES` and
|
||||
:variable:`CMAKE_LINK_LIBRARY_<FEATURE>_PROPERTIES` variables.
|
||||
:variable:`CMAKE_<LANG>_LINK_LIBRARY_<FEATURE>_ATTRIBUTES` and
|
||||
:variable:`CMAKE_LINK_LIBRARY_<FEATURE>_ATTRIBUTES` variables.
|
||||
|
||||
Feature Definitions
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -17,7 +17,7 @@ macro(__aix_compiler_gnu lang)
|
||||
set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v")
|
||||
|
||||
set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
|
||||
set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=ALL)
|
||||
set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL)
|
||||
|
||||
if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 7 OR CMAKE_SYSTEM_VERSION VERSION_LESS 7.1)
|
||||
unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
|
||||
|
@ -17,7 +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(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL)
|
||||
|
||||
set(_OBJECTS " <OBJECTS>")
|
||||
if(DEFINED CMAKE_XL_CreateExportList AND CMAKE_XL_CreateExportList STREQUAL "")
|
||||
|
@ -15,11 +15,11 @@ 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_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL)
|
||||
|
||||
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK "-framework <LIBRARY>")
|
||||
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
|
||||
set(CMAKE_${lang}_LINK_LIBRARY_FRAMEWORK_PROPERTIES LIBRARY_TYPE=STATIC,SHARED UNICITY=DEFAULT OVERRIDE=DEFAULT)
|
||||
set(CMAKE_${lang}_LINK_LIBRARY_FRAMEWORK_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT)
|
||||
|
||||
# linker selection
|
||||
set(CMAKE_${lang}_USING_LINKER_SYSTEM "-fuse-ld=ld")
|
||||
|
@ -17,7 +17,7 @@ macro(__apple_compiler_gnu lang)
|
||||
|
||||
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK "-framework <LIBRARY>")
|
||||
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_FRAMEWORK_PROPERTIES LIBRARY_TYPE=STATIC,SHARED UNICITY=DEFAULT OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_FRAMEWORK_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT)
|
||||
|
||||
set(CMAKE_${lang}_USING_LINKER_SYSTEM "")
|
||||
set(CMAKE_${lang}_USING_LINKER_APPLE_CLASSIC "LINKER:-ld_classic")
|
||||
|
@ -40,7 +40,7 @@ else()
|
||||
"LINKER:--no-whole-archive")
|
||||
endif()
|
||||
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES LIBRARY_TYPE=STATIC UNICITY=YES OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
|
||||
|
||||
|
||||
macro(__cygwin_compiler_gnu lang)
|
||||
|
@ -114,37 +114,37 @@ set(CMAKE_CREATE_TEXT_STUBS "<CMAKE_TAPI> stubify -isysroot <CMAKE_OSX_SYSROOT>
|
||||
# Defines LINK_LIBRARY features for frameworks
|
||||
set(CMAKE_LINK_LIBRARY_USING_FRAMEWORK "LINKER:-framework,<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_FRAMEWORK_PROPERTIES LIBRARY_TYPE=STATIC,SHARED UNICITY=DEFAULT OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_FRAMEWORK_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_NEEDED_FRAMEWORK "LINKER:-needed_framework,<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_NEEDED_FRAMEWORK_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_NEEDED_FRAMEWORK_PROPERTIES LIBRARY_TYPE=STATIC,SHARED UNICITY=DEFAULT OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_NEEDED_FRAMEWORK_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK "LINKER:-reexport_framework,<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_REEXPORT_FRAMEWORK_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_REEXPORT_FRAMEWORK_PROPERTIES LIBRARY_TYPE=STATIC,SHARED UNICITY=DEFAULT OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_REEXPORT_FRAMEWORK_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_WEAK_FRAMEWORK_PROPERTIES LIBRARY_TYPE=STATIC,SHARED UNICITY=DEFAULT OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WEAK_FRAMEWORK_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT)
|
||||
|
||||
# Defines LINK_LIBRARY features for libraries
|
||||
set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY "PATH{LINKER:-needed_library,<LIBRARY>}NAME{LINKER:-needed-l<LIBRARY>}")
|
||||
set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_NEEDED_LIBRARY_PROPERTIES LIBRARY_TYPE=SHARED UNICITY=DEFAULT OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_NEEDED_LIBRARY_ATTRIBUTES LIBRARY_TYPE=SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY "PATH{LINKER:-reexport_library,<LIBRARY>}NAME{LINKER:-reexport-l<LIBRARY>}")
|
||||
set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_REEXPORT_LIBRARY_PROPERTIES LIBRARY_TYPE=STATIC,SHARED UNICITY=DEFAULT OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_REEXPORT_LIBRARY_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY "PATH{LINKER:-weak_library,<LIBRARY>}NAME{LINKER:-weak-l<LIBRARY>}")
|
||||
set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_WEAK_LIBRARY_PROPERTIES LIBRARY_TYPE=STATIC,SHARED UNICITY=DEFAULT OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WEAK_LIBRARY_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT)
|
||||
|
||||
# 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)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES LIBRARY_TYPE=STATIC UNICITY=YES OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
|
||||
|
||||
# default to searching for frameworks first
|
||||
if(NOT DEFINED CMAKE_FIND_FRAMEWORK)
|
||||
|
@ -51,7 +51,7 @@ else()
|
||||
"LINKER:--no-whole-archive")
|
||||
endif()
|
||||
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES LIBRARY_TYPE=STATIC UNICITY=YES OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
|
||||
|
||||
|
||||
# Features for LINK_GROUP generator expression
|
||||
|
@ -44,7 +44,7 @@ else()
|
||||
"LINKER:--no-whole-archive")
|
||||
endif()
|
||||
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES LIBRARY_TYPE=STATIC UNICITY=YES OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
|
||||
|
||||
# Features for LINK_GROUP generator expression
|
||||
## RESCAN: request the linker to rescan static libraries until there is
|
||||
|
@ -37,7 +37,7 @@ else()
|
||||
"LINKER:--no-whole-archive")
|
||||
endif()
|
||||
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES LIBRARY_TYPE=STATIC UNICITY=YES OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
|
||||
|
||||
|
||||
# Features for LINK_GROUP generator expression
|
||||
|
@ -20,7 +20,7 @@ else()
|
||||
"LINKER:-z,defaultextract")
|
||||
endif()
|
||||
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES LIBRARY_TYPE=STATIC UNICITY=YES OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
|
||||
|
||||
|
||||
# Features for LINK_GROUP generator expression
|
||||
|
@ -55,7 +55,7 @@ macro(__windows_compiler_clang_gnu lang)
|
||||
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
|
||||
|
||||
set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD UNICITY=ALL)
|
||||
set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD DEDUPLICATION=ALL)
|
||||
|
||||
# linker selection
|
||||
set(CMAKE_${lang}_USING_LINKER_DEFAULT "-fuse-ld=lld-link")
|
||||
@ -140,7 +140,7 @@ macro(__windows_compiler_clang_gnu lang)
|
||||
## 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)
|
||||
set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES LIBRARY_TYPE=STATIC UNICITY=YES OVERRIDE=DEFAULT)
|
||||
set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
|
||||
endif()
|
||||
|
||||
enable_language(RC)
|
||||
|
@ -88,7 +88,7 @@ else()
|
||||
"LINKER:--no-whole-archive")
|
||||
endif()
|
||||
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES LIBRARY_TYPE=STATIC UNICITY=YES OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
|
||||
|
||||
# Features for LINK_GROUP generator expression
|
||||
## RESCAN: request the linker to rescan static libraries until there is
|
||||
|
@ -37,7 +37,7 @@ macro(__windows_compiler_intel lang)
|
||||
## WHOLE_ARCHIVE: Force loading all members of an archive
|
||||
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES LIBRARY_TYPE=STATIC UNICITY=YES OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
|
||||
endif()
|
||||
|
||||
set(CMAKE_${lang}_LINK_EXECUTABLE
|
||||
|
@ -358,7 +358,7 @@ 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)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_PROPERTIES LIBRARY_TYPE=STATIC UNICITY=YES OVERRIDE=DEFAULT)
|
||||
set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT)
|
||||
endif()
|
||||
|
||||
|
||||
@ -514,7 +514,7 @@ macro(__windows_compiler_msvc lang)
|
||||
set(CMAKE_${lang}_DEPFILE_FORMAT msvc)
|
||||
endif()
|
||||
|
||||
set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD UNICITY=ALL)
|
||||
set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD DEDUPLICATION=ALL)
|
||||
|
||||
# linker selection
|
||||
set(CMAKE_${lang}_USING_LINKER_SYSTEM "${CMAKE_LINKER_LINK}")
|
||||
|
@ -202,8 +202,8 @@ bool IsFeatureSupported(cmMakefile* makefile, std::string const& linkLanguage,
|
||||
return makefile->GetDefinition(featureSupported).IsOn();
|
||||
}
|
||||
|
||||
// LINK_LIBRARY feature properties management
|
||||
struct LinkLibraryFeaturePropertySet
|
||||
// LINK_LIBRARY feature attributes management
|
||||
struct LinkLibraryFeatureAttributeSet
|
||||
{
|
||||
std::set<cmStateEnums::TargetType> LibraryTypes = {
|
||||
cmStateEnums::EXECUTABLE, cmStateEnums::STATIC_LIBRARY,
|
||||
@ -212,84 +212,88 @@ struct LinkLibraryFeaturePropertySet
|
||||
};
|
||||
std::set<std::string> Override;
|
||||
|
||||
enum UnicityKind
|
||||
enum DeduplicationKind
|
||||
{
|
||||
Default,
|
||||
Yes,
|
||||
No
|
||||
};
|
||||
UnicityKind Unicity = Default;
|
||||
DeduplicationKind Deduplication = Default;
|
||||
};
|
||||
std::map<std::string, LinkLibraryFeaturePropertySet>
|
||||
LinkLibraryFeatureProperties;
|
||||
const LinkLibraryFeaturePropertySet& GetLinkLibraryFeatureProperties(
|
||||
std::map<std::string, LinkLibraryFeatureAttributeSet>
|
||||
LinkLibraryFeatureAttributes;
|
||||
const LinkLibraryFeatureAttributeSet& GetLinkLibraryFeatureAttributes(
|
||||
cmMakefile* makefile, std::string const& linkLanguage,
|
||||
const std::string& feature)
|
||||
{
|
||||
auto it = LinkLibraryFeatureProperties.find(feature);
|
||||
if (it != LinkLibraryFeatureProperties.end()) {
|
||||
auto it = LinkLibraryFeatureAttributes.find(feature);
|
||||
if (it != LinkLibraryFeatureAttributes.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
auto featurePropertiesVariable =
|
||||
cmStrCat("CMAKE_", linkLanguage, "_LINK_LIBRARY_", feature, "_PROPERTIES");
|
||||
auto featurePropertiesValues =
|
||||
makefile->GetDefinition(featurePropertiesVariable);
|
||||
if (featurePropertiesValues.IsEmpty()) {
|
||||
auto featureAttributesVariable =
|
||||
cmStrCat("CMAKE_", linkLanguage, "_LINK_LIBRARY_", feature, "_ATTRIBUTES");
|
||||
auto featureAttributesValues =
|
||||
makefile->GetDefinition(featureAttributesVariable);
|
||||
if (featureAttributesValues.IsEmpty()) {
|
||||
// try language agnostic definition
|
||||
featurePropertiesVariable =
|
||||
cmStrCat("CMAKE_LINK_LIBRARY_", feature, "_PROPERTIES");
|
||||
featurePropertiesValues =
|
||||
makefile->GetDefinition(featurePropertiesVariable);
|
||||
featureAttributesVariable =
|
||||
cmStrCat("CMAKE_LINK_LIBRARY_", feature, "_ATTRIBUTES");
|
||||
featureAttributesValues =
|
||||
makefile->GetDefinition(featureAttributesVariable);
|
||||
}
|
||||
if (!featurePropertiesValues.IsEmpty()) {
|
||||
LinkLibraryFeaturePropertySet featureProperties;
|
||||
if (!featureAttributesValues.IsEmpty()) {
|
||||
LinkLibraryFeatureAttributeSet featureAttributes;
|
||||
cmsys::RegularExpression processingOption{
|
||||
"^(LIBRARY_TYPE|UNICITY|OVERRIDE)=((STATIC|SHARED|MODULE|EXECUTABLE)(,("
|
||||
"^(LIBRARY_TYPE|DEDUPLICATION|OVERRIDE)=((STATIC|SHARED|MODULE|"
|
||||
"EXECUTABLE)(,("
|
||||
"STATIC|"
|
||||
"SHARED|MODULE|EXECUTABLE)"
|
||||
")*|YES|NO|DEFAULT|[A-Za-z0-9_]+(,[A-Za-z0-9_]+)*)$"
|
||||
};
|
||||
std::string errorMessage;
|
||||
for (auto const& option : cmList{ featurePropertiesValues }) {
|
||||
for (auto const& option : cmList{ featureAttributesValues }) {
|
||||
if (processingOption.find(option)) {
|
||||
if (processingOption.match(1) == "LIBRARY_TYPE") {
|
||||
featureProperties.LibraryTypes.clear();
|
||||
featureAttributes.LibraryTypes.clear();
|
||||
for (auto const& value :
|
||||
cmTokenize(processingOption.match(2), ","_s)) {
|
||||
if (value == "STATIC") {
|
||||
featureProperties.LibraryTypes.emplace(
|
||||
featureAttributes.LibraryTypes.emplace(
|
||||
cmStateEnums::STATIC_LIBRARY);
|
||||
} else if (value == "SHARED") {
|
||||
featureProperties.LibraryTypes.emplace(
|
||||
featureAttributes.LibraryTypes.emplace(
|
||||
cmStateEnums::SHARED_LIBRARY);
|
||||
} else if (value == "MODULE") {
|
||||
featureProperties.LibraryTypes.emplace(
|
||||
featureAttributes.LibraryTypes.emplace(
|
||||
cmStateEnums::MODULE_LIBRARY);
|
||||
} else if (value == "EXECUTABLE") {
|
||||
featureProperties.LibraryTypes.emplace(cmStateEnums::EXECUTABLE);
|
||||
featureAttributes.LibraryTypes.emplace(cmStateEnums::EXECUTABLE);
|
||||
} else {
|
||||
errorMessage += cmStrCat(" ", option, '\n');
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Always add UNKNOWN type
|
||||
featureProperties.LibraryTypes.emplace(
|
||||
featureAttributes.LibraryTypes.emplace(
|
||||
cmStateEnums::UNKNOWN_LIBRARY);
|
||||
} else if (processingOption.match(1) == "UNICITY") {
|
||||
} else if (processingOption.match(1) == "DEDUPLICATION") {
|
||||
if (processingOption.match(2) == "YES") {
|
||||
featureProperties.Unicity = LinkLibraryFeaturePropertySet::Yes;
|
||||
featureAttributes.Deduplication =
|
||||
LinkLibraryFeatureAttributeSet::Yes;
|
||||
} else if (processingOption.match(2) == "NO") {
|
||||
featureProperties.Unicity = LinkLibraryFeaturePropertySet::No;
|
||||
featureAttributes.Deduplication =
|
||||
LinkLibraryFeatureAttributeSet::No;
|
||||
} else if (processingOption.match(2) == "DEFAULT") {
|
||||
featureProperties.Unicity = LinkLibraryFeaturePropertySet::Default;
|
||||
featureAttributes.Deduplication =
|
||||
LinkLibraryFeatureAttributeSet::Default;
|
||||
} else {
|
||||
errorMessage += cmStrCat(" ", option, '\n');
|
||||
}
|
||||
} else if (processingOption.match(1) == "OVERRIDE") {
|
||||
featureProperties.Override.clear();
|
||||
featureAttributes.Override.clear();
|
||||
auto values = cmTokenize(processingOption.match(2), ","_s);
|
||||
featureProperties.Override.insert(values.begin(), values.end());
|
||||
featureAttributes.Override.insert(values.begin(), values.end());
|
||||
}
|
||||
} else {
|
||||
errorMessage += cmStrCat(" ", option, '\n');
|
||||
@ -298,14 +302,14 @@ const LinkLibraryFeaturePropertySet& GetLinkLibraryFeatureProperties(
|
||||
if (!errorMessage.empty()) {
|
||||
makefile->GetCMakeInstance()->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("Erroneous option(s) for '", featurePropertiesVariable,
|
||||
cmStrCat("Erroneous option(s) for '", featureAttributesVariable,
|
||||
"':\n", errorMessage));
|
||||
}
|
||||
return LinkLibraryFeatureProperties.emplace(feature, featureProperties)
|
||||
return LinkLibraryFeatureAttributes.emplace(feature, featureAttributes)
|
||||
.first->second;
|
||||
}
|
||||
return LinkLibraryFeatureProperties
|
||||
.emplace(feature, LinkLibraryFeaturePropertySet{})
|
||||
return LinkLibraryFeatureAttributes
|
||||
.emplace(feature, LinkLibraryFeatureAttributeSet{})
|
||||
.first->second;
|
||||
}
|
||||
|
||||
@ -376,8 +380,10 @@ public:
|
||||
case cmPolicies::NEW: {
|
||||
if (auto libProcessing = makefile->GetDefinition(cmStrCat(
|
||||
"CMAKE_", linkLanguage, "_LINK_LIBRARIES_PROCESSING"))) {
|
||||
// UNICITY keyword is just for compatibility with previous
|
||||
// implementation
|
||||
cmsys::RegularExpression processingOption{
|
||||
"^(ORDER|UNICITY)=(FORWARD|REVERSE|ALL|NONE|SHARED)$"
|
||||
"^(ORDER|UNICITY|DEDUPLICATION)=(FORWARD|REVERSE|ALL|NONE|SHARED)$"
|
||||
};
|
||||
std::string errorMessage;
|
||||
for (auto const& option : cmList{ libProcessing }) {
|
||||
@ -390,13 +396,14 @@ public:
|
||||
} else {
|
||||
errorMessage += cmStrCat(" ", option, '\n');
|
||||
}
|
||||
} else if (processingOption.match(1) == "UNICITY") {
|
||||
} else if (processingOption.match(1) == "UNICITY" ||
|
||||
processingOption.match(1) == "DEDUPLICATION") {
|
||||
if (processingOption.match(2) == "ALL") {
|
||||
this->Unicity = All;
|
||||
this->Deduplication = All;
|
||||
} else if (processingOption.match(2) == "NONE") {
|
||||
this->Unicity = None;
|
||||
this->Deduplication = None;
|
||||
} else if (processingOption.match(2) == "SHARED") {
|
||||
this->Unicity = Shared;
|
||||
this->Deduplication = Shared;
|
||||
} else {
|
||||
errorMessage += cmStrCat(" ", option, '\n');
|
||||
}
|
||||
@ -499,7 +506,7 @@ private:
|
||||
Reverse
|
||||
};
|
||||
|
||||
enum UnicityKind
|
||||
enum DeduplicationKind
|
||||
{
|
||||
None,
|
||||
Shared,
|
||||
@ -509,22 +516,23 @@ private:
|
||||
bool IncludeEntry(LinkEntry const& entry) const
|
||||
{
|
||||
if (entry.Feature != cmComputeLinkDepends::LinkEntry::DEFAULT) {
|
||||
auto const& featureProperties = GetLinkLibraryFeatureProperties(
|
||||
auto const& featureAttributes = GetLinkLibraryFeatureAttributes(
|
||||
this->Target->Makefile, this->LinkLanguage, entry.Feature);
|
||||
if ((entry.Target == nullptr ||
|
||||
featureProperties.LibraryTypes.find(entry.Target->GetType()) !=
|
||||
featureProperties.LibraryTypes.end()) &&
|
||||
featureProperties.Unicity !=
|
||||
LinkLibraryFeaturePropertySet::Default) {
|
||||
return featureProperties.Unicity == LinkLibraryFeaturePropertySet::No;
|
||||
featureAttributes.LibraryTypes.find(entry.Target->GetType()) !=
|
||||
featureAttributes.LibraryTypes.end()) &&
|
||||
featureAttributes.Deduplication !=
|
||||
LinkLibraryFeatureAttributeSet::Default) {
|
||||
return featureAttributes.Deduplication ==
|
||||
LinkLibraryFeatureAttributeSet::No;
|
||||
}
|
||||
}
|
||||
|
||||
return this->Unicity == None ||
|
||||
(this->Unicity == Shared &&
|
||||
return this->Deduplication == None ||
|
||||
(this->Deduplication == Shared &&
|
||||
(entry.Target == nullptr ||
|
||||
entry.Target->GetType() != cmStateEnums::SHARED_LIBRARY)) ||
|
||||
(this->Unicity == All && entry.Kind != LinkEntry::Library);
|
||||
(this->Deduplication == All && entry.Kind != LinkEntry::Library);
|
||||
}
|
||||
|
||||
template <typename Range>
|
||||
@ -539,7 +547,7 @@ private:
|
||||
}
|
||||
|
||||
OrderKind Order = Reverse;
|
||||
UnicityKind Unicity = Shared;
|
||||
DeduplicationKind Deduplication = Shared;
|
||||
const cmGeneratorTarget* Target;
|
||||
const std::string& LinkLanguage;
|
||||
EntryVector& Entries;
|
||||
@ -1121,27 +1129,29 @@ void cmComputeLinkDepends::AddLinkEntries(size_t depender_index,
|
||||
" library '", entry.Item.Value, "'."),
|
||||
this->Target->GetBacktrace());
|
||||
}
|
||||
// check if feature is applicable to this item
|
||||
if (itemFeature != LinkEntry::DEFAULT && entry.Target != nullptr) {
|
||||
auto const& featureAttributes = GetLinkLibraryFeatureAttributes(
|
||||
this->Makefile, this->LinkLanguage, itemFeature);
|
||||
if (featureAttributes.LibraryTypes.find(entry.Target->GetType()) ==
|
||||
featureAttributes.LibraryTypes.end()) {
|
||||
supportedItem = false;
|
||||
this->CMakeInstance->IssueMessage(
|
||||
MessageType::AUTHOR_WARNING,
|
||||
cmStrCat("The feature '", itemFeature,
|
||||
"', specified as part of a generator-expression "
|
||||
"'$<LINK_LIBRARY:",
|
||||
itemFeature, ">', will not be applied to the ",
|
||||
cmState::GetTargetTypeName(entry.Target->GetType()), " '",
|
||||
entry.Item.Value, "'."),
|
||||
this->Target->GetBacktrace());
|
||||
}
|
||||
}
|
||||
if (ale.second) {
|
||||
// current item not yet defined
|
||||
entry.Feature = itemFeature;
|
||||
|
||||
if (itemFeature != LinkEntry::DEFAULT && entry.Target != nullptr) {
|
||||
auto const& featureProperties = GetLinkLibraryFeatureProperties(
|
||||
this->Makefile, this->LinkLanguage, itemFeature);
|
||||
if (featureProperties.LibraryTypes.find(entry.Target->GetType()) ==
|
||||
featureProperties.LibraryTypes.end()) {
|
||||
supportedItem = false;
|
||||
entry.Feature = LinkEntry::DEFAULT;
|
||||
this->CMakeInstance->IssueMessage(
|
||||
MessageType::AUTHOR_WARNING,
|
||||
cmStrCat("The feature '", itemFeature,
|
||||
"', specified as part of a generator-expression "
|
||||
"'$<LINK_LIBRARY:",
|
||||
itemFeature, ">', will not be applied to the ",
|
||||
cmState::GetTargetTypeName(entry.Target->GetType()), " '",
|
||||
entry.Item.Value, "'."),
|
||||
this->Target->GetBacktrace());
|
||||
}
|
||||
if (!supportedItem) {
|
||||
entry.Feature = LinkEntry::DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1170,38 +1180,50 @@ void cmComputeLinkDepends::AddLinkEntries(size_t depender_index,
|
||||
if (entry.Feature != itemFeature) {
|
||||
bool incompatibleFeatures = true;
|
||||
// check if an override is possible
|
||||
auto const& entryFeatureProperties = GetLinkLibraryFeatureProperties(
|
||||
auto const& entryFeatureAttributes = GetLinkLibraryFeatureAttributes(
|
||||
this->Makefile, this->LinkLanguage, entry.Feature);
|
||||
auto const& itemFeatureProperties = GetLinkLibraryFeatureProperties(
|
||||
auto const& itemFeatureAttributes = GetLinkLibraryFeatureAttributes(
|
||||
this->Makefile, this->LinkLanguage, itemFeature);
|
||||
if (entryFeatureProperties.Override.empty() &&
|
||||
!itemFeatureProperties.Override.empty() &&
|
||||
itemFeatureProperties.Override.find(entry.Feature) !=
|
||||
itemFeatureProperties.Override.end()) {
|
||||
entry.Feature = itemFeature;
|
||||
incompatibleFeatures = false;
|
||||
} else if (!entryFeatureProperties.Override.empty() &&
|
||||
itemFeatureProperties.Override.empty() &&
|
||||
entryFeatureProperties.Override.find(itemFeature) !=
|
||||
entryFeatureProperties.Override.end()) {
|
||||
incompatibleFeatures = false;
|
||||
}
|
||||
if (incompatibleFeatures) {
|
||||
// incompatibles features occurred
|
||||
if (itemFeatureAttributes.Override.find(entry.Feature) !=
|
||||
itemFeatureAttributes.Override.end() &&
|
||||
entryFeatureAttributes.Override.find(itemFeature) !=
|
||||
entryFeatureAttributes.Override.end()) {
|
||||
// features override each other
|
||||
this->CMakeInstance->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("Impossible to link target '", this->Target->GetName(),
|
||||
"' because the link item '", entry.Item.Value,
|
||||
"', specified ",
|
||||
(itemFeature == LinkEntry::DEFAULT
|
||||
? "without any feature or 'DEFAULT' feature"
|
||||
: cmStrCat("with the feature '", itemFeature, '\'')),
|
||||
", has already occurred ",
|
||||
(entry.Feature == LinkEntry::DEFAULT
|
||||
? "without any feature or 'DEFAULT' feature"
|
||||
: cmStrCat("with the feature '", entry.Feature, '\'')),
|
||||
", which is not allowed."),
|
||||
"' is specified with the features '", itemFeature,
|
||||
"' and '", entry.Feature, "'",
|
||||
", and both have an 'OVERRIDE' attribute that overrides "
|
||||
"the other. Such cycles are not allowed."),
|
||||
this->Target->GetBacktrace());
|
||||
} else {
|
||||
if (itemFeatureAttributes.Override.find(entry.Feature) !=
|
||||
itemFeatureAttributes.Override.end()) {
|
||||
entry.Feature = itemFeature;
|
||||
incompatibleFeatures = false;
|
||||
} else if (entryFeatureAttributes.Override.find(itemFeature) !=
|
||||
entryFeatureAttributes.Override.end()) {
|
||||
incompatibleFeatures = false;
|
||||
}
|
||||
if (incompatibleFeatures) {
|
||||
// incompatibles features occurred
|
||||
this->CMakeInstance->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat(
|
||||
"Impossible to link target '", this->Target->GetName(),
|
||||
"' because the link item '", entry.Item.Value, "', specified ",
|
||||
(itemFeature == LinkEntry::DEFAULT
|
||||
? "without any feature or 'DEFAULT' feature"
|
||||
: cmStrCat("with the feature '", itemFeature, '\'')),
|
||||
", has already occurred ",
|
||||
(entry.Feature == LinkEntry::DEFAULT
|
||||
? "without any feature or 'DEFAULT' feature"
|
||||
: cmStrCat("with the feature '", entry.Feature, '\'')),
|
||||
", which is not allowed."),
|
||||
this->Target->GetBacktrace());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +36,12 @@ run_cmake(override-features3)
|
||||
run_cmake(override-features4)
|
||||
run_cmake(override-features5)
|
||||
|
||||
# testing feature properties specification
|
||||
run_cmake(bad-feature-properties1)
|
||||
run_cmake(bad-feature-properties2)
|
||||
run_cmake(bad-feature-properties3)
|
||||
run_cmake(bad-feature-properties4)
|
||||
run_cmake(bad-feature-properties5)
|
||||
# testing feature attributes specification
|
||||
run_cmake(bad-feature-attributes1)
|
||||
run_cmake(bad-feature-attributes2)
|
||||
run_cmake(bad-feature-attributes3)
|
||||
run_cmake(bad-feature-attributes4)
|
||||
run_cmake(bad-feature-attributes5)
|
||||
run_cmake(unsupported-library_type)
|
||||
run_cmake(cyclic-override)
|
||||
run_cmake(multiple-override)
|
||||
|
@ -0,0 +1,4 @@
|
||||
CMake Error:
|
||||
Erroneous option\(s\) for 'CMAKE_LINK_LIBRARY_feature_ATTRIBUTES':
|
||||
|
||||
BAD_ATTRIBUTE=XXX
|
@ -2,7 +2,7 @@ enable_language(C)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature "<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_feature_PROPERTIES UNICITY=YES,NO)
|
||||
set(CMAKE_LINK_LIBRARY_feature_ATTRIBUTES BAD_ATTRIBUTE=XXX)
|
||||
|
||||
add_library(dep SHARED empty.c)
|
||||
|
@ -0,0 +1,4 @@
|
||||
CMake Error:
|
||||
Erroneous option\(s\) for 'CMAKE_LINK_LIBRARY_feature_ATTRIBUTES':
|
||||
|
||||
BAD_ATTRIBUTE=XXX
|
@ -2,7 +2,7 @@ enable_language(C)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature "<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_feature_PROPERTIES LIBRARY_TYPE=STATIC BAD_PROPERTY=XXX UNICITY=YES)
|
||||
set(CMAKE_LINK_LIBRARY_feature_ATTRIBUTES LIBRARY_TYPE=STATIC BAD_ATTRIBUTE=XXX DEDUPLICATION=YES)
|
||||
|
||||
add_library(dep SHARED empty.c)
|
||||
|
@ -0,0 +1,4 @@
|
||||
CMake Error:
|
||||
Erroneous option\(s\) for 'CMAKE_LINK_LIBRARY_feature_ATTRIBUTES':
|
||||
|
||||
LIBRARY_TYPE=STATIC,BAD_TYPE
|
@ -2,7 +2,7 @@ enable_language(C)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature "<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_feature_PROPERTIES LIBRARY_TYPE=STATIC,BAD_TYPE)
|
||||
set(CMAKE_LINK_LIBRARY_feature_ATTRIBUTES LIBRARY_TYPE=STATIC,BAD_TYPE)
|
||||
|
||||
add_library(dep SHARED empty.c)
|
||||
|
@ -0,0 +1,4 @@
|
||||
CMake Error:
|
||||
Erroneous option\(s\) for 'CMAKE_LINK_LIBRARY_feature_ATTRIBUTES':
|
||||
|
||||
LIBRARY_TYPE=STATIC,BAD_TYPE
|
@ -0,0 +1,10 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature "<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_feature_ATTRIBUTES DEDUPLICATION=YES LIBRARY_TYPE=STATIC,BAD_TYPE)
|
||||
|
||||
add_library(dep SHARED empty.c)
|
||||
|
||||
add_library(lib SHARED empty.c)
|
||||
target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feature,dep>")
|
@ -0,0 +1,4 @@
|
||||
CMake Error:
|
||||
Erroneous option\(s\) for 'CMAKE_LINK_LIBRARY_feature_ATTRIBUTES':
|
||||
|
||||
DEDUPLICATION=YES,NO
|
@ -2,7 +2,7 @@ enable_language(C)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature "<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_feature_PROPERTIES UNICITY=YES LIBRARY_TYPE=STATIC,BAD_TYPE)
|
||||
set(CMAKE_LINK_LIBRARY_feature_ATTRIBUTES DEDUPLICATION=YES,NO)
|
||||
|
||||
add_library(dep SHARED empty.c)
|
||||
|
@ -1,4 +0,0 @@
|
||||
CMake Error:
|
||||
Erroneous option\(s\) for 'CMAKE_LINK_LIBRARY_feature_PROPERTIES':
|
||||
|
||||
BAD_PROPERTY=XXX
|
@ -1,4 +0,0 @@
|
||||
CMake Error:
|
||||
Erroneous option\(s\) for 'CMAKE_LINK_LIBRARY_feature_PROPERTIES':
|
||||
|
||||
BAD_PROPERTY=XXX
|
@ -1,4 +0,0 @@
|
||||
CMake Error:
|
||||
Erroneous option\(s\) for 'CMAKE_LINK_LIBRARY_feature_PROPERTIES':
|
||||
|
||||
LIBRARY_TYPE=STATIC,BAD_TYPE
|
@ -1,4 +0,0 @@
|
||||
CMake Error:
|
||||
Erroneous option\(s\) for 'CMAKE_LINK_LIBRARY_feature_PROPERTIES':
|
||||
|
||||
LIBRARY_TYPE=STATIC,BAD_TYPE
|
@ -1,4 +0,0 @@
|
||||
CMake Error:
|
||||
Erroneous option\(s\) for 'CMAKE_LINK_LIBRARY_feature_PROPERTIES':
|
||||
|
||||
UNICITY=YES,NO
|
@ -0,0 +1,6 @@
|
||||
CMake Error at cyclic-override.cmake:[0-9]+ \(add_library\):
|
||||
Impossible to link target 'lib' because the link item 'dep' is specified
|
||||
with the features 'feature2' and 'feature1', and both have an 'OVERRIDE'
|
||||
attribute that overrides the other. Such cycles are not allowed.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
14
Tests/RunCMake/GenEx-LINK_LIBRARY/cyclic-override.cmake
Normal file
14
Tests/RunCMake/GenEx-LINK_LIBRARY/cyclic-override.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature1 "<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature1_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_feature1_ATTRIBUTES OVERRIDE=feature2)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature2 "<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature2_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_feature2_ATTRIBUTES OVERRIDE=feature1)
|
||||
|
||||
add_library(dep SHARED empty.c)
|
||||
|
||||
add_library(lib SHARED empty.c)
|
||||
target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feature1,dep>" "$<LINK_LIBRARY:feature2,dep>")
|
@ -2,7 +2,7 @@ enable_language(C)
|
||||
|
||||
set(CMAKE_C_LINK_LIBRARY_USING_feat_SUPPORTED TRUE)
|
||||
set(CMAKE_C_LINK_LIBRARY_USING_feat "<LIBRARY>")
|
||||
set(CMAKE_C_LINK_LIBRARY_feat_PROPERTIES "LIBRARY_TYPE=STATIC")
|
||||
set(CMAKE_C_LINK_LIBRARY_feat_ATTRIBUTES "LIBRARY_TYPE=STATIC")
|
||||
|
||||
add_library(dep OBJECT empty.c)
|
||||
|
||||
|
14
Tests/RunCMake/GenEx-LINK_LIBRARY/multiple-override.cmake
Normal file
14
Tests/RunCMake/GenEx-LINK_LIBRARY/multiple-override.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature1 "<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature1_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_feature1_ATTRIBUTES OVERRIDE=feature2)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature2 "<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature2_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_feature2_ATTRIBUTES OVERRIDE=feature3)
|
||||
|
||||
add_library(dep SHARED empty.c)
|
||||
|
||||
add_library(lib SHARED empty.c)
|
||||
target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feature1,dep>" "$<LINK_LIBRARY:feature2,dep>")
|
@ -0,0 +1,6 @@
|
||||
CMake Warning \(dev\) at unsupported-library_type.cmake:[0-9]+ \(add_library\):
|
||||
The feature 'feature', specified as part of a generator-expression
|
||||
'\$<LINK_LIBRARY:feature>', will not be applied to the SHARED_LIBRARY 'dep'.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
@ -2,7 +2,7 @@ enable_language(C)
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature "<LIBRARY>")
|
||||
set(CMAKE_LINK_LIBRARY_USING_feature_SUPPORTED TRUE)
|
||||
set(CMAKE_LINK_LIBRARY_feature_PROPERTIES BAD_PROPERTY=XXX)
|
||||
set(CMAKE_LINK_LIBRARY_feature_ATTRIBUTES LIBRARY_TYPE=STATIC)
|
||||
|
||||
add_library(dep SHARED empty.c)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING ORDER= UNICITY=ALL)
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING ORDER= DEDUPLICATION=ALL)
|
||||
|
||||
add_library(lib STATIC lib.c)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING UNICITY=ALL ORDER)
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING DEDUPLICATION=ALL ORDER)
|
||||
|
||||
add_library(lib STATIC lib.c)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING WRONG=REVERSE UNICITY=ALL)
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING WRONG=REVERSE DEDUPLICATION=ALL)
|
||||
|
||||
add_library(lib STATIC lib.c)
|
||||
|
||||
|
@ -2,7 +2,7 @@ CMake Error at InvalidConfiguration4.cmake:[0-9]+ \(add_executable\):
|
||||
Erroneous option\(s\) for 'CMAKE_C_LINK_LIBRARIES_PROCESSING':
|
||||
|
||||
WRONG=REVERSE
|
||||
UNICITY=WRONG
|
||||
DEDUPLICATION=WRONG
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING WRONG=REVERSE UNICITY=WRONG)
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING WRONG=REVERSE DEDUPLICATION=WRONG)
|
||||
|
||||
add_library(lib STATIC lib.c)
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
@ -1,7 +1,7 @@
|
||||
CMake Error at Invalid_UNICITY.cmake:[0-9]+ \(add_executable\):
|
||||
CMake Error at Invalid_DEDUPLICATION.cmake:[0-9]+ \(add_executable\):
|
||||
Erroneous option\(s\) for 'CMAKE_C_LINK_LIBRARIES_PROCESSING':
|
||||
|
||||
UNICITY=WRONG
|
||||
DEDUPLICATION=WRONG
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
@ -1,7 +1,7 @@
|
||||
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=WRONG)
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=WRONG)
|
||||
|
||||
add_library(lib STATIC lib.c)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING ORDER=WRONG UNICITY=ALL)
|
||||
set(CMAKE_C_LINK_LIBRARIES_PROCESSING ORDER=WRONG DEDUPLICATION=ALL)
|
||||
|
||||
add_library(lib STATIC lib.c)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(Invalid_ORDER)
|
||||
run_cmake(Invalid_UNICITY)
|
||||
run_cmake(Invalid_DEDUPLICATION)
|
||||
run_cmake(InvalidConfiguration1)
|
||||
run_cmake(InvalidConfiguration2)
|
||||
run_cmake(InvalidConfiguration3)
|
||||
|
Loading…
Reference in New Issue
Block a user