Merge topic 'remove-old-compatibility'

3c4afba8cc Remove compatibility with CMake versions older than 2.8.12
0453f70400 CMP0023: Remove support for OLD behavior
033a2dc000 cmLinkItem: Remove now-unused fields from link interfaces
c965856a1d cmGeneratorTarget: Simplify storage of link implementation
888259c894 CMP0022: Remove support for OLD behavior
e31d1c7600 CMP0021: Remove support for OLD behavior
094b42b643 CMP0020: Remove support for OLD behavior
092d6de4be CMP0019: Remove support for OLD behavior
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10195
This commit is contained in:
Brad King
2025-01-19 14:38:58 +00:00
committed by Kitware Robot
93 changed files with 238 additions and 1228 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
.. versionchanged:: 4.0
Compatibility with versions of CMake older than 2.8.0 is removed.
Compatibility with versions of CMake older than 2.8.12 is removed.
Calls to :command:`cmake_minimum_required(VERSION)` or
:command:`cmake_policy(VERSION)` that do not specify at least
2.8.0 as their policy version (optionally via ``...<max>``)
2.8.12 as their policy version (optionally via ``...<max>``)
will produce an error in CMake 4.0 and above.
.. versionchanged:: 3.31
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0015
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
:command:`link_directories` treats paths relative to the source dir.
In CMake 2.8.0 and lower the :command:`link_directories` command passed
@@ -13,7 +16,5 @@ this policy is to use relative paths verbatim in the linker command. The
paths by appending the relative path to ``CMAKE_CURRENT_SOURCE_DIR``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.1
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0016
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
:command:`target_link_libraries` reports error if its only argument
is not a target.
@@ -10,7 +13,5 @@ wasn't a valid target. In CMake 2.8.3 and above it reports an error
in this case.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.3
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0017
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Prefer files from the CMake module directory when including from there.
Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e.
@@ -15,7 +18,5 @@ behavior is to always prefer files from CMAKE_MODULE_PATH over files
from the CMake modules directory.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.4
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0018
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Ignore ``CMAKE_SHARED_LIBRARY_<Lang>_FLAGS`` variable.
CMake 2.8.8 and lower compiled sources in ``SHARED`` and ``MODULE`` libraries
@@ -28,7 +31,5 @@ The ``NEW`` behavior for this policy is to ignore
honor the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.9
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0019
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Do not re-expand variables in include and link information.
CMake 2.8.10 and lower re-evaluated values given to the
@@ -16,7 +19,5 @@ strict compatibility. The ``NEW`` behavior for this policy is to leave
the values untouched.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.11
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0020
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Automatically link Qt executables to ``qtmain`` target on Windows.
CMake 2.8.10 and lower required users of Qt to always specify a link
@@ -21,7 +24,5 @@ The ``NEW`` behavior for this policy is to link executables to ``qtmain.lib``
automatically when they link to QtCore ``IMPORTED`` target.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.11
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0021
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Fatal error on relative paths in :prop_tgt:`INCLUDE_DIRECTORIES` target
property.
@@ -15,7 +18,5 @@ policy is to issue a ``FATAL_ERROR`` if ``INCLUDE_DIRECTORIES`` contains a
relative path.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0022
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
:prop_tgt:`INTERFACE_LINK_LIBRARIES` defines the link interface.
CMake 2.8.11 constructed the 'link interface' of a target from
@@ -33,7 +36,5 @@ property for in-build targets, and ignore the old properties matching
``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0023
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Plain and keyword :command:`target_link_libraries` signatures cannot be mixed.
CMake 2.8.12 introduced the :command:`target_link_libraries` signature using
@@ -29,7 +32,5 @@ this policy is to not to allow mixing of the keyword and plain
signatures.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt
@@ -1,7 +1,7 @@
remove-old-compatibility
------------------------
* Compatibility with versions of CMake older than 2.8.0 has been removed.
* Compatibility with versions of CMake older than 2.8.12 has been removed.
Calls to :command:`cmake_minimum_required` or :command:`cmake_policy`
that set the policy version to an older value now issue an error.
Note that calls to those commands can still support older versions of
+2 -4
View File
@@ -1080,23 +1080,21 @@ if (QT_QMAKE_EXECUTABLE AND
set(_isExe $<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>)
set(_isWin32 $<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>)
set(_isNotExcluded $<NOT:$<BOOL:$<TARGET_PROPERTY:QT4_NO_LINK_QTMAIN>>>)
set(_isPolicyNEW $<TARGET_POLICY:CMP0020>)
get_target_property(_configs Qt4::QtCore IMPORTED_CONFIGURATIONS)
set_property(TARGET Qt4::QtCore APPEND PROPERTY
INTERFACE_LINK_LIBRARIES
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt4::qtmain>
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded}>:Qt4::qtmain>
)
foreach(_config ${_configs})
set_property(TARGET Qt4::QtCore APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt4::qtmain>
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded}>:Qt4::qtmain>
)
endforeach()
unset(_configs)
unset(_isExe)
unset(_isWin32)
unset(_isNotExcluded)
unset(_isPolicyNEW)
endif()
#######################################
-18
View File
@@ -12,13 +12,9 @@
#include "cmGeneratorTarget.h"
#include "cmLinkItem.h"
#include "cmList.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
cmExportAndroidMKGenerator::cmExportAndroidMKGenerator() = default;
@@ -52,20 +48,6 @@ void cmExportAndroidMKGenerator::GenerateInterfaceProperties(
(this->Configurations.empty() ? std::string{} : this->Configurations[0]);
GenerateType const type = this->GetGenerateType();
bool const newCMP0022Behavior =
target->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (!newCMP0022Behavior) {
std::ostringstream w;
if (type == BUILD) {
w << "export(TARGETS ... ANDROID_MK) called with policy CMP0022";
} else {
w << "install( EXPORT_ANDROID_MK ...) called with policy CMP0022";
}
w << " set to OLD for target " << target->Target->GetName() << ". "
<< "The export will only work with CMP0022 set to NEW.";
target->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
}
if (!properties.empty()) {
os << "LOCAL_CPP_FEATURES := rtti exceptions\n";
for (auto const& property : properties) {
+2 -8
View File
@@ -7,7 +7,6 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -34,13 +33,8 @@ bool cmExportBuildAndroidMKGenerator::GenerateMainFile(std::ostream& os)
return false;
}
bool const newCMP0022Behavior =
gte->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
gte->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior) {
this->PopulateInterfaceLinkLibrariesProperty(
gte, cmGeneratorExpression::BuildInterface, properties);
}
this->PopulateInterfaceLinkLibrariesProperty(
gte, cmGeneratorExpression::BuildInterface, properties);
this->GenerateInterfaceProperties(gte, os, properties);
}
+2 -8
View File
@@ -24,7 +24,6 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -72,13 +71,8 @@ bool cmExportBuildCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
return false;
}
bool const newCMP0022Behavior =
gte->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
gte->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior) {
this->PopulateInterfaceLinkLibrariesProperty(
gte, cmGeneratorExpression::BuildInterface, properties);
}
this->PopulateInterfaceLinkLibrariesProperty(
gte, cmGeneratorExpression::BuildInterface, properties);
this->GenerateInterfaceProperties(gte, os, properties);
+3 -15
View File
@@ -17,12 +17,10 @@
#include "cmFindPackageStack.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmLinkItem.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -30,6 +28,8 @@
#include "cmValue.h"
#include "cmVersion.h"
struct cmLinkInterface;
static std::string cmExportFileGeneratorEscape(std::string const& str)
{
// Escape a property value for writing into a .cmake file.
@@ -111,14 +111,6 @@ void cmExportCMakeConfigGenerator::SetImportLinkInterface(
return;
}
if (iface->ImplementationIsInterface) {
// Policy CMP0022 must not be NEW.
this->SetImportLinkProperty(
suffix, target, "IMPORTED_LINK_INTERFACE_LIBRARIES", iface->Libraries,
properties, ImportLinkPropertyTargetNames::Yes);
return;
}
cmValue propContent;
if (cmValue prop_suffixed =
@@ -130,11 +122,7 @@ void cmExportCMakeConfigGenerator::SetImportLinkInterface(
return;
}
bool const newCMP0022Behavior =
target->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior && !this->ExportOld) {
if (!this->ExportOld) {
cmLocalGenerator* lg = target->GetLocalGenerator();
std::ostringstream e;
e << "Target \"" << target->GetName()
+2 -8
View File
@@ -12,7 +12,6 @@
#include "cmGeneratorTarget.h"
#include "cmInstallExportGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -58,13 +57,8 @@ bool cmExportInstallAndroidMKGenerator::GenerateMainFile(std::ostream& os)
return false;
}
bool const newCMP0022Behavior =
gt->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
gt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior) {
this->PopulateInterfaceLinkLibrariesProperty(
gt, cmGeneratorExpression::InstallInterface, properties);
}
this->PopulateInterfaceLinkLibrariesProperty(
gt, cmGeneratorExpression::InstallInterface, properties);
this->GenerateInterfaceProperties(gt, os, properties);
}
+4 -10
View File
@@ -25,7 +25,6 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -83,15 +82,10 @@ bool cmExportInstallCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
return false;
}
bool const newCMP0022Behavior =
gt->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
gt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior) {
if (this->PopulateInterfaceLinkLibrariesProperty(
gt, cmGeneratorExpression::InstallInterface, properties) &&
!this->ExportOld) {
this->SetRequiredCMakeVersion(2, 8, 12);
}
if (this->PopulateInterfaceLinkLibrariesProperty(
gt, cmGeneratorExpression::InstallInterface, properties) &&
!this->ExportOld) {
this->SetRequiredCMakeVersion(2, 8, 12);
}
if (targetType == cmStateEnums::INTERFACE_LIBRARY) {
this->SetRequiredCMakeVersion(3, 0, 0);
+1 -1
View File
@@ -5012,7 +5012,7 @@ bool cmGeneratorTarget::DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
std::vector<std::string> allConfigs =
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
cmOptionalLinkImplementation impl;
this->ComputeLinkImplementationLibraries(config, impl, this, UseTo::Link);
this->ComputeLinkImplementationLibraries(config, impl, UseTo::Link);
cmCxxModuleUsageEffects usage(this);
+1 -15
View File
@@ -449,7 +449,6 @@ public:
void ComputeLinkImplementationLibraries(const std::string& config,
cmOptionalLinkImplementation& impl,
const cmGeneratorTarget* head,
UseTo usage) const;
struct TargetOrString
@@ -1360,22 +1359,10 @@ private:
void GetSourceFilesWithoutObjectLibraries(std::vector<cmSourceFile*>& files,
const std::string& config) const;
struct HeadToLinkImplementationMap
: public std::map<cmGeneratorTarget const*, cmOptionalLinkImplementation>
{
};
using LinkImplMapType = std::map<std::string, HeadToLinkImplementationMap>;
using LinkImplMapType = std::map<std::string, cmOptionalLinkImplementation>;
mutable LinkImplMapType LinkImplMap;
mutable LinkImplMapType LinkImplUsageRequirementsOnlyMap;
HeadToLinkImplementationMap& GetHeadToLinkImplementationMap(
std::string const& config) const;
HeadToLinkImplementationMap& GetHeadToLinkImplementationUsageRequirementsMap(
std::string const& config) const;
cmLinkImplementationLibraries const* GetLinkImplementationLibrariesInternal(
const std::string& config, const cmGeneratorTarget* head,
UseTo usage) const;
bool ComputeOutputDir(const std::string& config,
cmStateEnums::ArtifactType artifact,
std::string& out) const;
@@ -1394,7 +1381,6 @@ private:
mutable OutputNameMapType OutputNameMap;
mutable std::set<cmLinkItem> UtilityItems;
cmPolicies::PolicyMap PolicyMap;
mutable bool PolicyWarnedCMP0022 = false;
mutable bool PolicyReportedCMP0069 = false;
mutable bool DebugIncludesDone = false;
mutable bool DebugCompileOptionsDone = false;
@@ -185,7 +185,6 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt,
if (!cmSystemTools::FileIsFullPath(entryInclude)) {
std::ostringstream e;
bool noMessage = false;
MessageType messageType = MessageType::FATAL_ERROR;
if (!targetName.empty()) {
/* clang-format off */
@@ -194,27 +193,13 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt,
" \"" << entryInclude << "\"";
/* clang-format on */
} else {
switch (tgt->GetPolicyStatusCMP0021()) {
case cmPolicies::WARN: {
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0021) << "\n";
messageType = MessageType::AUTHOR_WARNING;
} break;
case cmPolicies::OLD:
noMessage = true;
break;
case cmPolicies::NEW:
// Issue the fatal message.
break;
}
e << "Found relative path while evaluating include directories of "
"\""
<< tgt->GetName() << "\":\n \"" << entryInclude << "\"\n";
}
if (!noMessage) {
tgt->GetLocalGenerator()->IssueMessage(messageType, e.str());
if (messageType == MessageType::FATAL_ERROR) {
return;
}
tgt->GetLocalGenerator()->IssueMessage(messageType, e.str());
if (messageType == MessageType::FATAL_ERROR) {
return;
}
}
+56 -220
View File
@@ -382,16 +382,8 @@ void cmGeneratorTarget::CheckLinkLibraries() const
}
// Check link the implementation for each generated configuration.
for (auto const& hmp : this->LinkImplMap) {
HeadToLinkImplementationMap const& hm = hmp.second;
// There could be several entries used when computing the pre-CMP0022
// default link interface. Check only the entry for our own link impl.
auto const hmi = hm.find(this);
if (hmi == hm.end() || !hmi->second.LibrariesDone ||
!hmi->second.CheckLinkLibraries) {
continue;
}
for (cmLinkImplItem const& item : hmi->second.Libraries) {
for (auto const& impl : this->LinkImplMap) {
for (cmLinkImplItem const& item : impl.second.Libraries) {
if (!this->VerifyLinkItemColons(LinkItemRole::Implementation, item)) {
return;
}
@@ -688,40 +680,34 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config,
cmOptionalLinkInterface& iface,
bool secondPass) const
{
if (iface.Explicit) {
if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
std::set<cmLinkItem> emitted;
for (cmLinkItem const& lib : iface.Libraries) {
emitted.insert(lib);
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
cmLinkImplementation const* impl =
this->GetLinkImplementation(config, UseTo::Link, secondPass);
for (cmLinkImplItem const& lib : impl->Libraries) {
if (emitted.insert(lib).second) {
if (lib.Target) {
// This is a runtime dependency on another shared library.
if (lib.Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
iface.SharedDeps.push_back(lib);
}
} else {
// TODO: Recognize shared library file names. Perhaps this
// should be moved to cmComputeLinkInformation, but that
// creates a chicken-and-egg problem since this list is needed
// for its construction.
if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
std::set<cmLinkItem> emitted;
for (cmLinkItem const& lib : iface.Libraries) {
emitted.insert(lib);
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
cmLinkImplementation const* impl =
this->GetLinkImplementation(config, UseTo::Link, secondPass);
for (cmLinkImplItem const& lib : impl->Libraries) {
if (emitted.insert(lib).second) {
if (lib.Target) {
// This is a runtime dependency on another shared library.
if (lib.Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
iface.SharedDeps.push_back(lib);
}
} else {
// TODO: Recognize shared library file names. Perhaps this
// should be moved to cmComputeLinkInformation, but that
// creates a chicken-and-egg problem since this list is needed
// for its construction.
}
}
}
}
} else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN ||
this->GetPolicyStatusCMP0022() == cmPolicies::OLD) {
// The link implementation is the default link interface.
iface.ImplementationIsInterface = true;
}
if (this->LinkLanguagePropagatesToDependents()) {
@@ -804,62 +790,10 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
// An explicit list of interface libraries may be set for shared
// libraries and executables that export symbols.
bool haveExplicitLibraries = false;
cmValue explicitLibrariesCMP0022OLD;
std::string linkIfacePropCMP0022OLD;
bool const cmp0022NEW = (this->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
this->GetPolicyStatusCMP0022() != cmPolicies::WARN);
if (cmp0022NEW) {
// CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
haveExplicitLibraries = !this->Target->GetLinkInterfaceEntries().empty() ||
!this->Target->GetLinkInterfaceDirectEntries().empty() ||
!this->Target->GetLinkInterfaceDirectExcludeEntries().empty();
} else {
// CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
// shared lib or executable.
if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->IsExecutableWithExports()) {
// Lookup the per-configuration property.
linkIfacePropCMP0022OLD = cmStrCat("LINK_INTERFACE_LIBRARIES", suffix);
explicitLibrariesCMP0022OLD = this->GetProperty(linkIfacePropCMP0022OLD);
// If not set, try the generic property.
if (!explicitLibrariesCMP0022OLD) {
linkIfacePropCMP0022OLD = "LINK_INTERFACE_LIBRARIES";
explicitLibrariesCMP0022OLD =
this->GetProperty(linkIfacePropCMP0022OLD);
}
}
if (explicitLibrariesCMP0022OLD &&
this->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
!this->PolicyWarnedCMP0022) {
// Compare the explicitly set old link interface properties to the
// preferred new link interface property one and warn if different.
cmValue newExplicitLibraries =
this->GetProperty("INTERFACE_LINK_LIBRARIES");
if (newExplicitLibraries &&
(*newExplicitLibraries != *explicitLibrariesCMP0022OLD)) {
std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
"Target \"" << this->GetName() << "\" has an "
"INTERFACE_LINK_LIBRARIES property which differs from its " <<
linkIfacePropCMP0022OLD << " properties."
"\n"
"INTERFACE_LINK_LIBRARIES:\n"
" " << *newExplicitLibraries << "\n" <<
linkIfacePropCMP0022OLD << ":\n"
" " << *explicitLibrariesCMP0022OLD << "\n";
/* clang-format on */
this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING,
w.str());
this->PolicyWarnedCMP0022 = true;
}
}
haveExplicitLibraries = static_cast<bool>(explicitLibrariesCMP0022OLD);
}
bool const haveExplicitLibraries =
!this->Target->GetLinkInterfaceEntries().empty() ||
!this->Target->GetLinkInterfaceDirectEntries().empty() ||
!this->Target->GetLinkInterfaceDirectExcludeEntries().empty();
// There is no implicit link interface for executables or modules
// so if none was explicitly set then there is no link interface.
@@ -870,84 +804,19 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
}
iface.Exists = true;
// If CMP0022 is NEW then the plain tll signature sets the
// INTERFACE_LINK_LIBRARIES property. Even if the project
// clears it, the link interface is still explicit.
iface.Explicit = cmp0022NEW || explicitLibrariesCMP0022OLD;
if (cmp0022NEW) {
// The interface libraries are specified by INTERFACE_LINK_LIBRARIES.
// Use its special representation directly to get backtraces.
this->ExpandLinkItems(
kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(),
config, headTarget, usage, LinkInterfaceField::Libraries, iface);
this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT,
this->Target->GetLinkInterfaceDirectEntries(),
config, headTarget, usage,
LinkInterfaceField::HeadInclude, iface);
this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE,
this->Target->GetLinkInterfaceDirectExcludeEntries(),
config, headTarget, usage,
LinkInterfaceField::HeadExclude, iface);
} else if (explicitLibrariesCMP0022OLD) {
// The interface libraries have been explicitly set in pre-CMP0022 style.
std::vector<BT<std::string>> entries;
entries.emplace_back(*explicitLibrariesCMP0022OLD);
this->ExpandLinkItems(linkIfacePropCMP0022OLD, cmMakeRange(entries),
config, headTarget, usage,
LinkInterfaceField::Libraries, iface);
}
// If the link interface is explicit, do not fall back to the link impl.
if (iface.Explicit) {
return;
}
// The link implementation is the default link interface.
if (cmLinkImplementationLibraries const* impl =
this->GetLinkImplementationLibrariesInternal(config, headTarget,
usage)) {
iface.Libraries.insert(iface.Libraries.end(), impl->Libraries.begin(),
impl->Libraries.end());
if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
!this->PolicyWarnedCMP0022 && usage == UseTo::Link) {
// Compare the link implementation fallback link interface to the
// preferred new link interface property and warn if different.
cmLinkInterface ifaceNew;
this->ExpandLinkItems(
kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(),
config, headTarget, usage, LinkInterfaceField::Libraries, ifaceNew);
if (ifaceNew.Libraries != iface.Libraries) {
std::string oldLibraries = cmJoin(impl->Libraries, ";");
std::string newLibraries = cmJoin(ifaceNew.Libraries, ";");
if (oldLibraries.empty()) {
oldLibraries = "(empty)";
}
if (newLibraries.empty()) {
newLibraries = "(empty)";
}
std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
"Target \"" << this->GetName() << "\" has an "
"INTERFACE_LINK_LIBRARIES property. "
"This should be preferred as the source of the link interface "
"for this library but because CMP0022 is not set CMake is "
"ignoring the property and using the link implementation "
"as the link interface instead."
"\n"
"INTERFACE_LINK_LIBRARIES:\n"
" " << newLibraries << "\n"
"Link implementation:\n"
" " << oldLibraries << "\n";
/* clang-format on */
this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING,
w.str());
this->PolicyWarnedCMP0022 = true;
}
}
}
// The interface libraries are specified by INTERFACE_LINK_LIBRARIES.
// Use its special representation directly to get backtraces.
this->ExpandLinkItems(
kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(), config,
headTarget, usage, LinkInterfaceField::Libraries, iface);
this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT,
this->Target->GetLinkInterfaceDirectEntries(), config,
headTarget, usage, LinkInterfaceField::HeadInclude,
iface);
this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE,
this->Target->GetLinkInterfaceDirectExcludeEntries(),
config, headTarget, usage,
LinkInterfaceField::HeadExclude, iface);
}
namespace {
@@ -1116,18 +985,18 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
return nullptr;
}
HeadToLinkImplementationMap& hm =
cmOptionalLinkImplementation& impl =
(usage == UseTo::Compile
? this->GetHeadToLinkImplementationUsageRequirementsMap(config)
: this->GetHeadToLinkImplementationMap(config));
cmOptionalLinkImplementation& impl = hm[this];
? this
->LinkImplUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)]
: this->LinkImplMap[cmSystemTools::UpperCase(config)]);
if (secondPass) {
impl = cmOptionalLinkImplementation();
}
MaybeEnableCheckLinkLibraries(impl);
if (!impl.LibrariesDone) {
impl.LibrariesDone = true;
this->ComputeLinkImplementationLibraries(config, impl, this, usage);
this->ComputeLinkImplementationLibraries(config, impl, usage);
}
if (!impl.LanguagesDone) {
impl.LanguagesDone = true;
@@ -1137,31 +1006,9 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
return &impl;
}
cmGeneratorTarget::HeadToLinkImplementationMap&
cmGeneratorTarget::GetHeadToLinkImplementationMap(
std::string const& config) const
{
return this->LinkImplMap[cmSystemTools::UpperCase(config)];
}
cmGeneratorTarget::HeadToLinkImplementationMap&
cmGeneratorTarget::GetHeadToLinkImplementationUsageRequirementsMap(
std::string const& config) const
{
return this
->LinkImplUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)];
}
cmLinkImplementationLibraries const*
cmGeneratorTarget::GetLinkImplementationLibraries(const std::string& config,
UseTo usage) const
{
return this->GetLinkImplementationLibrariesInternal(config, this, usage);
}
cmLinkImplementationLibraries const*
cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
const std::string& config, cmGeneratorTarget const* head, UseTo usage) const
{
// There is no link implementation for targets that cannot compile sources.
if (!this->CanCompileSources()) {
@@ -1169,22 +1016,15 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
}
// Populate the link implementation libraries for this configuration.
HeadToLinkImplementationMap& hm =
cmOptionalLinkImplementation& impl =
(usage == UseTo::Compile
? this->GetHeadToLinkImplementationUsageRequirementsMap(config)
: this->GetHeadToLinkImplementationMap(config));
// If the link implementation does not depend on the head target
// then reuse the one from the head we computed first.
if (!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) {
head = hm.begin()->first;
}
cmOptionalLinkImplementation& impl = hm[head];
? this
->LinkImplUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)]
: this->LinkImplMap[cmSystemTools::UpperCase(config)]);
MaybeEnableCheckLinkLibraries(impl);
if (!impl.LibrariesDone) {
impl.LibrariesDone = true;
this->ComputeLinkImplementationLibraries(config, impl, head, usage);
this->ComputeLinkImplementationLibraries(config, impl, usage);
}
return &impl;
}
@@ -1218,9 +1058,7 @@ public:
void TransitiveLinkImpl::Follow(cmGeneratorTarget const* target)
{
if (!target || !this->Followed.insert(target).second ||
target->GetPolicyStatusCMP0022() == cmPolicies::OLD ||
target->GetPolicyStatusCMP0022() == cmPolicies::WARN) {
if (!target || !this->Followed.insert(target).second) {
return;
}
@@ -1299,7 +1137,7 @@ void ComputeLinkImplTransitive(cmGeneratorTarget const* self,
void cmGeneratorTarget::ComputeLinkImplementationLibraries(
const std::string& config, cmOptionalLinkImplementation& impl,
cmGeneratorTarget const* head, UseTo usage) const
UseTo usage) const
{
cmLocalGenerator const* lg = this->LocalGenerator;
cmMakefile const* mf = lg->GetMakefile();
@@ -1329,7 +1167,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
ge.Parse(entry.Value);
cge->SetEvaluateForBuildsystem(true);
std::string const& evaluated =
cge->Evaluate(this->LocalGenerator, config, head, &dagChecker, nullptr,
cge->Evaluate(this->LocalGenerator, config, this, &dagChecker, nullptr,
this->LinkerLanguage);
bool const checkCMP0027 = evaluated != entry.Value;
cmList llibs(evaluated);
@@ -1431,9 +1269,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
}
// Update the list of direct link dependencies from usage requirements.
if (head == this) {
ComputeLinkImplTransitive(this, config, usage, impl);
}
ComputeLinkImplTransitive(this, config, usage, impl);
// Get the list of configurations considered to be DEBUG.
std::vector<std::string> debugConfigs =
+1 -1
View File
@@ -203,7 +203,7 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
std::string flags;
this->LocalGenerator->AddLanguageFlags(
flags, this->GeneratorTarget, cmBuildStep::Compile, language, config);
this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget,
this->LocalGenerator->AddFeatureFlags(flags, this->GeneratorTarget,
language, config);
this->LocalGenerator->AddVisibilityPresetFlags(
flags, this->GeneratorTarget, language);
-16
View File
@@ -981,12 +981,6 @@ void cmGlobalGenerator::EnableLanguage(
}
}
// Store the shared library flags so that we can satisfy CMP0018
std::string sharedLibFlagsVar =
cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS");
this->LanguageToOriginalSharedLibFlags[lang] =
mf->GetSafeDefinition(sharedLibFlagsVar);
// Translate compiler ids for compatibility.
this->CheckCompilerIdCompatibility(mf, lang);
} // end for each language
@@ -3475,16 +3469,6 @@ bool cmGlobalGenerator::ShouldStripResourcePath(cmMakefile* mf) const
return mf->PlatformIsAppleEmbedded();
}
std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
std::string const& l) const
{
auto const it = this->LanguageToOriginalSharedLibFlags.find(l);
if (it != this->LanguageToOriginalSharedLibFlags.end()) {
return it->second;
}
return "";
}
void cmGlobalGenerator::AppendDirectoryForConfig(const std::string& /*unused*/,
const std::string& /*unused*/,
const std::string& /*unused*/,
-3
View File
@@ -591,8 +591,6 @@ public:
virtual bool SupportsLinkerDependencyFile() const { return false; }
std::string GetSharedLibFlagsForLanguage(std::string const& lang) const;
/** Generate an <output>.rule file path for a given command output. */
virtual std::string GenerateRuleFile(std::string const& output) const;
@@ -826,7 +824,6 @@ private:
std::map<std::string, std::string> LanguageToOutputExtension;
std::map<std::string, std::string> ExtensionToLanguage;
std::map<std::string, int> LanguageToLinkerPreference;
std::map<std::string, std::string> LanguageToOriginalSharedLibFlags;
#if !defined(CMAKE_BOOTSTRAP)
std::unique_ptr<Json::StreamWriter> JsonWriter;
+1 -2
View File
@@ -2421,8 +2421,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
}
// Add shared-library flags if needed.
this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang,
this->CurrentLocalGenerator->AddFeatureFlags(flags, gtgt, lang,
configName);
this->CurrentLocalGenerator->AddVisibilityPresetFlags(flags, gtgt, lang);
-17
View File
@@ -2156,23 +2156,6 @@ bool HandleExportMode(std::vector<std::string> const& args,
cmExportSet& exportSet =
helper.Makefile->GetGlobalGenerator()->GetExportSets()[exp];
if (exportOld) {
for (auto const& te : exportSet.GetTargetExports()) {
cmTarget* tgt =
helper.Makefile->GetGlobalGenerator()->FindTarget(te->TargetName);
const bool newCMP0022Behavior =
(tgt && tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD);
if (!newCMP0022Behavior) {
status.SetError(cmStrCat(
"INSTALL(EXPORT) given keyword \""
"EXPORT_LINK_INTERFACE_LIBRARIES\", but target \"",
te->TargetName, "\" does not have policy CMP0022 set to NEW."));
return false;
}
}
}
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(helper.Makefile);
+1 -27
View File
@@ -2,14 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLinkDirectoriesCommand.h"
#include <sstream>
#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmList.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -52,29 +48,7 @@ static void AddLinkDir(cmMakefile& mf, std::string const& dir,
cmSystemTools::ConvertToUnixSlashes(unixPath);
if (!cmSystemTools::FileIsFullPath(unixPath) &&
!cmGeneratorExpression::StartsWithGeneratorExpression(unixPath)) {
bool convertToAbsolute = false;
std::ostringstream e;
/* clang-format off */
e << "This command specifies the relative path\n"
<< " " << unixPath << "\n"
<< "as a link directory.\n";
/* clang-format on */
switch (mf.GetPolicyStatus(cmPolicies::CMP0015)) {
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015);
mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
CM_FALLTHROUGH;
case cmPolicies::OLD:
// OLD behavior does not convert
break;
case cmPolicies::NEW:
// NEW behavior converts
convertToAbsolute = true;
break;
}
if (convertToAbsolute) {
unixPath = cmStrCat(mf.GetCurrentSourceDirectory(), '/', unixPath);
}
unixPath = cmStrCat(mf.GetCurrentSourceDirectory(), '/', unixPath);
}
directories.push_back(unixPath);
}
-3
View File
@@ -104,8 +104,6 @@ struct cmLinkInterface : public cmLinkInterfaceLibraries
// or more static libraries.
unsigned int Multiplicity = 0;
bool ImplementationIsInterface = false;
// Whether the list depends on a link language genex.
bool HadLinkLanguageSensitiveCondition = false;
};
@@ -115,7 +113,6 @@ struct cmOptionalLinkInterface : public cmLinkInterface
bool LibrariesDone = false;
bool AllDone = false;
bool Exists = false;
bool Explicit = false;
bool CheckLinkLibraries = false;
};
+6 -60
View File
@@ -1749,7 +1749,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetTargetCompileFlags(
}
}
this->AddCMP0018Flags(compileFlags, target, lang, config);
this->AddFeatureFlags(compileFlags, target, lang, config);
this->AddVisibilityPresetFlags(compileFlags, target, lang);
this->AddColorDiagnosticsFlags(compileFlags, lang);
this->AppendFlags(compileFlags, mf->GetDefineFlags());
@@ -2423,19 +2423,6 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
return true;
}
void cmLocalGenerator::AddSharedFlags(std::string& flags,
const std::string& lang, bool shared)
{
std::string flagsVar;
// Add flags for dealing with shared libraries for this language.
if (shared) {
this->AppendFlags(flags,
this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS")));
}
}
static void AddVisibilityCompileOption(std::string& flags,
cmGeneratorTarget const* target,
cmLocalGenerator* lg,
@@ -2540,7 +2527,7 @@ void cmLocalGenerator::AddVisibilityPresetFlags(
}
}
void cmLocalGenerator::AddCMP0018Flags(std::string& flags,
void cmLocalGenerator::AddFeatureFlags(std::string& flags,
cmGeneratorTarget const* target,
std::string const& lang,
const std::string& config)
@@ -2550,54 +2537,13 @@ void cmLocalGenerator::AddCMP0018Flags(std::string& flags,
bool shared = ((targetType == cmStateEnums::SHARED_LIBRARY) ||
(targetType == cmStateEnums::MODULE_LIBRARY));
if (this->GetShouldUseOldFlags(shared, lang)) {
this->AddSharedFlags(flags, lang, shared);
} else {
if (target->GetLinkInterfaceDependentBoolProperty(
"POSITION_INDEPENDENT_CODE", config)) {
this->AddPositionIndependentFlags(flags, lang, targetType);
}
if (shared) {
this->AppendFeatureOptions(flags, lang, "DLL");
}
if (target->GetLinkInterfaceDependentBoolProperty(
"POSITION_INDEPENDENT_CODE", config)) {
this->AddPositionIndependentFlags(flags, lang, targetType);
}
}
bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
const std::string& lang) const
{
std::string originalFlags =
this->GlobalGenerator->GetSharedLibFlagsForLanguage(lang);
if (shared) {
std::string flagsVar = cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS");
std::string const& flags = this->Makefile->GetSafeDefinition(flagsVar);
if (flags != originalFlags) {
switch (this->GetPolicyStatus(cmPolicies::CMP0018)) {
case cmPolicies::WARN: {
std::ostringstream e;
e << "Variable " << flagsVar
<< " has been modified. CMake "
"will ignore the POSITION_INDEPENDENT_CODE target property "
"for "
"shared libraries and will use the "
<< flagsVar
<< " variable "
"instead. This may cause errors if the original content of "
<< flagsVar << " was removed.\n"
<< cmPolicies::GetPolicyWarning(cmPolicies::CMP0018);
this->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
CM_FALLTHROUGH;
}
case cmPolicies::OLD:
return true;
case cmPolicies::NEW:
return false;
}
}
this->AppendFeatureOptions(flags, lang, "DLL");
}
return false;
}
void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
+1 -4
View File
@@ -141,7 +141,7 @@ public:
cmGeneratorTarget const* target,
const std::string& lang,
const std::string& config);
void AddCMP0018Flags(std::string& flags, cmGeneratorTarget const* target,
void AddFeatureFlags(std::string& flags, cmGeneratorTarget const* target,
std::string const& lang, const std::string& config);
void AddVisibilityPresetFlags(std::string& flags,
cmGeneratorTarget const* target,
@@ -629,9 +629,6 @@ private:
OutputRole role, cmListFileBacktrace const& bt,
cmCommandOrigin origin);
void AddSharedFlags(std::string& flags, const std::string& lang,
bool shared);
bool GetShouldUseOldFlags(bool shared, const std::string& lang) const;
void AddPositionIndependentFlags(std::string& flags, std::string const& l,
int targetType);
+12 -128
View File
@@ -1007,9 +1007,6 @@ void cmMakefile::GeneratorAction::operator()(cmLocalGenerator& lg,
void cmMakefile::DoGenerate(cmLocalGenerator& lg)
{
// do all the variable expansions here
this->ExpandVariablesCMP0019();
// give all the commands a chance to do something
// after the file has been parsed before generation
for (auto& action : this->GeneratorActions) {
@@ -1744,7 +1741,7 @@ void cmMakefile::Configure()
this->SetCheckCMP0000(true);
// Implicitly set the version for the user.
cmPolicies::ApplyPolicyVersion(this, 2, 8, 0,
cmPolicies::ApplyPolicyVersion(this, 2, 8, 12,
cmPolicies::WarnCompat::Off);
}
}
@@ -2303,94 +2300,6 @@ cmSourceGroup* cmMakefile::FindSourceGroup(
}
#endif
static bool mightExpandVariablesCMP0019(const char* s)
{
return s && *s && strstr(s, "${") && strchr(s, '}');
}
void cmMakefile::ExpandVariablesCMP0019()
{
// Drop this ancient compatibility behavior with a policy.
cmPolicies::PolicyStatus pol = this->GetPolicyStatus(cmPolicies::CMP0019);
if (pol != cmPolicies::OLD && pol != cmPolicies::WARN) {
return;
}
std::string e;
cmValue includeDirs = this->GetProperty("INCLUDE_DIRECTORIES");
if (includeDirs && mightExpandVariablesCMP0019(includeDirs->c_str())) {
std::string dirs = *includeDirs;
this->ExpandVariablesInString(dirs, true, true);
if (pol == cmPolicies::WARN && dirs != *includeDirs) {
e = cmStrCat("Evaluated directory INCLUDE_DIRECTORIES\n ", *includeDirs,
"\nas\n ", dirs, '\n');
}
this->SetProperty("INCLUDE_DIRECTORIES", dirs);
}
// Also for each target's INCLUDE_DIRECTORIES property:
for (auto& target : this->Targets) {
cmTarget& t = target.second;
if (t.GetType() == cmStateEnums::INTERFACE_LIBRARY ||
t.GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
includeDirs = t.GetProperty("INCLUDE_DIRECTORIES");
if (includeDirs && mightExpandVariablesCMP0019(includeDirs->c_str())) {
std::string dirs = *includeDirs;
this->ExpandVariablesInString(dirs, true, true);
if (pol == cmPolicies::WARN && dirs != *includeDirs) {
e += cmStrCat("Evaluated target ", t.GetName(),
" INCLUDE_DIRECTORIES\n ", *includeDirs, "\nas\n ",
dirs, '\n');
}
t.SetProperty("INCLUDE_DIRECTORIES", dirs);
}
}
if (cmValue linkDirsProp = this->GetProperty("LINK_DIRECTORIES")) {
if (mightExpandVariablesCMP0019(linkDirsProp->c_str())) {
std::string d = *linkDirsProp;
const std::string orig = d;
this->ExpandVariablesInString(d, true, true);
if (pol == cmPolicies::WARN && d != orig) {
e += cmStrCat("Evaluated link directories\n ", orig, "\nas\n ", d,
'\n');
}
}
}
if (cmValue linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
cmList linkLibs{ *linkLibsProp };
for (auto l = linkLibs.begin(); l != linkLibs.end(); ++l) {
std::string libName = *l;
if (libName == "optimized"_s || libName == "debug"_s) {
++l;
libName = *l;
}
if (mightExpandVariablesCMP0019(libName.c_str())) {
const std::string orig = libName;
this->ExpandVariablesInString(libName, true, true);
if (pol == cmPolicies::WARN && libName != orig) {
e += cmStrCat("Evaluated link library\n ", orig, "\nas\n ",
libName, '\n');
}
}
}
}
if (!e.empty()) {
auto m = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0019),
"\n"
"The following variable evaluations were encountered:\n",
e);
this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, m,
this->Backtrace);
}
}
bool cmMakefile::IsOn(const std::string& name) const
{
return this->GetDefinition(name).IsOn();
@@ -3737,16 +3646,6 @@ std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system,
{
std::string result;
// We search the module always in CMAKE_ROOT and in CMAKE_MODULE_PATH,
// and then decide based on the policy setting which one to return.
// See CMP0017 for more details.
// The specific problem was that KDE 4.5.0 installs a
// FindPackageHandleStandardArgs.cmake which doesn't have the new features
// of FPHSA.cmake introduced in CMake 2.8.3 yet, and by setting
// CMAKE_MODULE_PATH also e.g. FindZLIB.cmake from cmake included
// FPHSA.cmake from kdelibs and not from CMake, and tried to use the
// new features, which were not there in the version from kdelibs, and so
// failed ("
std::string moduleInCMakeRoot;
std::string moduleInCMakeModulePath;
@@ -3784,37 +3683,22 @@ std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system,
// Normally, prefer the files found in CMAKE_MODULE_PATH. Only when the file
// from which we are being called is located itself in CMAKE_ROOT, then
// prefer results from CMAKE_ROOT depending on the policy setting.
system = false;
result = moduleInCMakeModulePath;
if (result.empty()) {
system = true;
result = moduleInCMakeRoot;
}
if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty()) {
cmValue currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
std::string mods = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/");
if (currentFile && cmSystemTools::IsSubDirectory(*currentFile, mods)) {
switch (this->GetPolicyStatus(cmPolicies::CMP0017)) {
case cmPolicies::WARN: {
auto e = cmStrCat(
"File ", *currentFile, " includes ", moduleInCMakeModulePath,
" (found via CMAKE_MODULE_PATH) which shadows ", moduleInCMakeRoot,
". This may cause errors later on .\n",
cmPolicies::GetPolicyWarning(cmPolicies::CMP0017));
this->IssueMessage(MessageType::AUTHOR_WARNING, e);
CM_FALLTHROUGH;
}
case cmPolicies::OLD:
system = false;
result = moduleInCMakeModulePath;
break;
case cmPolicies::NEW:
system = true;
result = moduleInCMakeRoot;
break;
}
system = true;
result = moduleInCMakeRoot;
} else {
system = false;
result = moduleInCMakeModulePath;
}
} else if (!moduleInCMakeModulePath.empty()) {
system = false;
result = moduleInCMakeModulePath;
} else {
system = true;
result = moduleInCMakeRoot;
}
return result;
-5
View File
@@ -717,11 +717,6 @@ public:
*/
void RemoveVariablesInString(std::string& source, bool atOnly = false) const;
/**
* Expand variables in the makefiles ivars such as link directories etc
*/
void ExpandVariablesCMP0019();
/**
* Replace variables and #cmakedefine lines in the given string.
* See cmConfigureFileCommand for details.
+4 -3
View File
@@ -295,16 +295,17 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
WarnCompat warnCompat)
{
// Error on policy versions for which support has been removed.
if (majorVer < 2 || (majorVer == 2 && minorVer < 8)) {
if (majorVer < 2 ||
(majorVer == 2 && (minorVer < 8 || (minorVer == 8 && patchVer < 12)))) {
if (IsFromLegacyInstallEXPORT(mf, majorVer, minorVer, patchVer)) {
// Silently tolerate cmake_policy calls generated by install(EXPORT)
// in CMake versions prior to 3.18.
majorVer = 2;
minorVer = 8;
patchVer = 0;
patchVer = 12;
} else {
mf->IssueMessage(MessageType::FATAL_ERROR,
"Compatibility with CMake < 2.8.0 has been removed "
"Compatibility with CMake < 2.8.12 has been removed "
"from CMake.\n" ADVICE_UPDATE_VERSION_ARGUMENT);
cmSystemTools::SetFatalErrorOccurred();
return false;
+9 -9
View File
@@ -56,34 +56,34 @@ class cmMakefile;
8, 0, NEW) \
SELECT(POLICY, CMP0015, \
"link_directories() treats paths relative to the source dir.", 2, 8, \
1, WARN) \
1, NEW) \
SELECT(POLICY, CMP0016, \
"target_link_libraries() reports error if its only argument " \
"is not a target.", \
2, 8, 3, WARN) \
2, 8, 3, NEW) \
SELECT(POLICY, CMP0017, \
"Prefer files from the CMake module directory when including from " \
"there.", \
2, 8, 4, WARN) \
2, 8, 4, NEW) \
SELECT(POLICY, CMP0018, \
"Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", 2, 8, 9, WARN) \
"Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", 2, 8, 9, NEW) \
SELECT(POLICY, CMP0019, \
"Do not re-expand variables in include and link information.", 2, 8, \
11, WARN) \
11, NEW) \
SELECT(POLICY, CMP0020, \
"Automatically link Qt executables to qtmain target on Windows.", 2, \
8, 11, WARN) \
8, 11, NEW) \
SELECT( \
POLICY, CMP0021, \
"Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \
2, 8, 12, WARN) \
2, 8, 12, NEW) \
SELECT(POLICY, CMP0022, \
"INTERFACE_LINK_LIBRARIES defines the link interface.", 2, 8, 12, \
WARN) \
NEW) \
SELECT( \
POLICY, CMP0023, \
"Plain and keyword target_link_libraries signatures cannot be mixed.", 2, \
8, 12, WARN) \
8, 12, NEW) \
SELECT(POLICY, CMP0024, "Disallow include export result.", 3, 0, 0, WARN) \
SELECT(POLICY, CMP0025, "Compiler id for Apple Clang is now AppleClang.", \
3, 0, 0, WARN) \
-8
View File
@@ -999,14 +999,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
// Record current policies for later use.
this->impl->Makefile->RecordPolicies(this->impl->PolicyMap);
if (this->impl->TargetType == cmStateEnums::INTERFACE_LIBRARY) {
// This policy is checked in a few conditions. The properties relevant
// to the policy are always ignored for cmStateEnums::INTERFACE_LIBRARY
// targets,
// so ensure that the conditions don't lead to nonsense.
this->impl->PolicyMap.Set(cmPolicies::CMP0022, cmPolicies::NEW);
}
std::set<TargetProperty::InitCondition> metConditions;
metConditions.insert(TargetProperty::InitCondition::Always);
if (this->CanCompileSources()) {
+21 -136
View File
@@ -25,8 +25,6 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
#include "cmValue.h"
#include "cmake.h"
namespace {
@@ -95,42 +93,11 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
}
}
if (!target) {
MessageType t = MessageType::FATAL_ERROR; // fail by default
std::ostringstream e;
e << "Cannot specify link libraries for target \"" << args[0]
<< "\" which is not built by this project.";
// The bad target is the only argument. Check how policy CMP0016 is set,
// and accept, warn or fail respectively:
if (args.size() < 2) {
switch (mf.GetPolicyStatus(cmPolicies::CMP0016)) {
case cmPolicies::WARN:
t = MessageType::AUTHOR_WARNING;
// Print the warning.
e << "\n"
"CMake does not support this but it used to work accidentally "
"and is being allowed for compatibility."
"\n"
<< cmPolicies::GetPolicyWarning(cmPolicies::CMP0016);
break;
case cmPolicies::OLD: // OLD behavior does not warn.
t = MessageType::MESSAGE;
break;
case cmPolicies::NEW: // NEW behavior prints the error.
break;
}
}
// Now actually print the message.
switch (t) {
case MessageType::AUTHOR_WARNING:
mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
break;
case MessageType::FATAL_ERROR:
mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
cmSystemTools::SetFatalErrorOccurred();
break;
default:
break;
}
mf.IssueMessage(MessageType::FATAL_ERROR,
cmStrCat("Cannot specify link libraries for target \"",
args[0],
"\" which is not built by this project."));
cmSystemTools::SetFatalErrorOccurred();
return true;
}
@@ -358,21 +325,6 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
cmSystemTools::SetFatalErrorOccurred();
}
const cmPolicies::PolicyStatus policy22Status =
target->GetPolicyStatusCMP0022();
// If any of the LINK_ options were given, make sure the
// LINK_INTERFACE_LIBRARIES target property exists.
// Use of any of the new keywords implies awareness of
// this property. And if no libraries are named, it should
// result in an empty link interface.
if ((policy22Status == cmPolicies::OLD ||
policy22Status == cmPolicies::WARN) &&
currentProcessingState != ProcessingLinkLibraries &&
!target->GetProperty("LINK_INTERFACE_LIBRARIES")) {
target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
}
return true;
}
@@ -444,41 +396,22 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState,
if (!this->Target->PushTLLCommandTrace(
sig, this->Makefile.GetBacktrace().Top())) {
std::ostringstream e;
const char* modal = nullptr;
MessageType messageType = MessageType::AUTHOR_WARNING;
switch (this->Makefile.GetPolicyStatus(cmPolicies::CMP0023)) {
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << '\n';
modal = "should";
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
case cmPolicies::NEW:
modal = "must";
messageType = MessageType::FATAL_ERROR;
break;
}
if (modal) {
// If the sig is a keyword form and there is a conflict, the existing
// form must be the plain form.
const char* existingSig =
(sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword");
e << "The " << existingSig
<< " signature for target_link_libraries has "
"already been used with the target \""
<< this->Target->GetName()
<< "\". All uses of target_link_libraries with a target " << modal
<< " be either all-keyword or all-plain.\n";
this->Target->GetTllSignatureTraces(e,
sig == cmTarget::KeywordTLLSignature
? cmTarget::PlainTLLSignature
: cmTarget::KeywordTLLSignature);
this->Makefile.IssueMessage(messageType, e.str());
if (messageType == MessageType::FATAL_ERROR) {
return false;
}
}
// If the sig is a keyword form and there is a conflict, the existing
// form must be the plain form.
const char* existingSig =
(sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword");
e << "The " << existingSig
<< " signature for target_link_libraries has "
"already been used with the target \""
<< this->Target->GetName()
<< "\". All uses of target_link_libraries with a target must "
<< " be either all-keyword or all-plain.\n";
this->Target->GetTllSignatureTraces(e,
sig == cmTarget::KeywordTLLSignature
? cmTarget::PlainTLLSignature
: cmTarget::KeywordTLLSignature);
this->Makefile.IssueMessage(MessageType::FATAL_ERROR, e.str());
return false;
}
// Handle normal case where the command was called with another keyword than
@@ -559,54 +492,6 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState,
// property of the target on the LHS shall be populated.)
this->AppendProperty("INTERFACE_LINK_LIBRARIES",
this->Target->GetDebugGeneratorExpressions(lib, llt));
// Stop processing if called without any keyword.
if (currentProcessingState == ProcessingLinkLibraries) {
return true;
}
// Stop processing if policy CMP0022 is set to NEW.
const cmPolicies::PolicyStatus policy22Status =
this->Target->GetPolicyStatusCMP0022();
if (policy22Status != cmPolicies::OLD &&
policy22Status != cmPolicies::WARN) {
return true;
}
// Stop processing if called with an INTERFACE library on the LHS.
if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return true;
}
// Handle (additional) backward-compatibility case where the command was
// called with PUBLIC / INTERFACE / LINK_PUBLIC / LINK_INTERFACE_LIBRARIES.
// (The policy CMP0022 is not set to NEW.)
{
// Get the list of configurations considered to be DEBUG.
std::vector<std::string> debugConfigs =
this->Makefile.GetCMakeInstance()->GetDebugConfigs();
std::string prop;
// Include this library in the link interface for the target.
if (llt == DEBUG_LibraryType || llt == GENERAL_LibraryType) {
// Put in the DEBUG configuration interfaces.
for (std::string const& dc : debugConfigs) {
prop = cmStrCat("LINK_INTERFACE_LIBRARIES_", dc);
this->AppendProperty(prop, lib);
}
}
if (llt == OPTIMIZED_LibraryType || llt == GENERAL_LibraryType) {
// Put in the non-DEBUG configuration interfaces.
this->AppendProperty("LINK_INTERFACE_LIBRARIES", lib);
// Make sure the DEBUG configuration interfaces exist so that the
// general one will not be used as a fall-back.
for (std::string const& dc : debugConfigs) {
prop = cmStrCat("LINK_INTERFACE_LIBRARIES_", dc);
if (!this->Target->GetProperty(prop)) {
this->Target->SetProperty(prop, "");
}
}
}
}
return true;
}
@@ -1,7 +1,4 @@
# Using 2.8 will trigger a deprecation warning. In this case it's explicitly
# intentional since the tests checks various policy implementations prior to
# 3.10
cmake_minimum_required(VERSION 2.8.11) # old enough to not set CMP0022
cmake_minimum_required(VERSION 3.10)
if(POLICY CMP0129)
cmake_policy(SET CMP0129 NEW)
@@ -53,38 +50,38 @@ generate_export_header(depC)
target_link_libraries(depC LINK_PUBLIC depA LINK_PUBLIC depA)
assert_property(depA LINK_INTERFACE_LIBRARIES "")
assert_property(depB LINK_INTERFACE_LIBRARIES "")
assert_property(depC LINK_INTERFACE_LIBRARIES "depA;depA")
assert_property(depA INTERFACE_LINK_LIBRARIES "")
assert_property(depB INTERFACE_LINK_LIBRARIES "")
assert_property(depC INTERFACE_LINK_LIBRARIES "depA;depA")
add_executable(targetA targetA.cpp)
target_link_libraries(targetA LINK_INTERFACE_LIBRARIES depA depB)
assert_property(targetA LINK_INTERFACE_LIBRARIES "depA;depB")
assert_property(targetA INTERFACE_LINK_LIBRARIES "depA;depB")
set_target_properties(targetA PROPERTIES LINK_INTERFACE_LIBRARIES "")
set_target_properties(targetA PROPERTIES INTERFACE_LINK_LIBRARIES "")
assert_property(targetA LINK_INTERFACE_LIBRARIES "")
assert_property(targetA INTERFACE_LINK_LIBRARIES "")
add_subdirectory(subdir)
target_link_libraries(targetA subdirlib)
target_link_libraries(targetA depB depC)
assert_property(targetA LINK_INTERFACE_LIBRARIES "")
assert_property(targetA INTERFACE_LINK_LIBRARIES ";subdirlib;depB;depC")
# Exclude depIfaceOnly from ALL so that it will only be built if something
# depends on it. As it is in the link interface of depB, targetA
# will depend on it. That dependency is what is being tested here.
add_library(depIfaceOnly SHARED EXCLUDE_FROM_ALL depIfaceOnly.cpp)
generate_export_header(depIfaceOnly)
set_property(TARGET depB APPEND PROPERTY LINK_INTERFACE_LIBRARIES depIfaceOnly)
set_property(TARGET depB APPEND PROPERTY INTERFACE_LINK_LIBRARIES depIfaceOnly)
add_library(depD SHARED depD.cpp)
generate_export_header(depD)
set_property(TARGET depD APPEND PROPERTY
LINK_INTERFACE_LIBRARIES
INTERFACE_LINK_LIBRARIES
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:depA>
)
+35 -66
View File
@@ -1,5 +1,5 @@
set(CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_DEPENDENCIES "1942b4fa-b2c5-4546-9385-83f254070067")
cmake_minimum_required(VERSION 2.8.11) # old enough to not set CMP0022
cmake_minimum_required(VERSION 3.10)
if(POLICY CMP0129)
cmake_policy(SET CMP0129 NEW)
endif()
@@ -22,10 +22,9 @@ add_library(testExe2libImp SHARED testExe2libImp.c)
set_property(TARGET testExe2libImp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl)
add_library(testExe2lib SHARED testExe2lib.c)
target_link_libraries(testExe2lib testExe2libImp)
set_property(TARGET testExe2lib PROPERTY LINK_INTERFACE_LIBRARIES "")
add_executable(testExe2 testExe2.c)
set_property(TARGET testExe2 PROPERTY ENABLE_EXPORTS 1)
set_property(TARGET testExe2 PROPERTY LINK_INTERFACE_LIBRARIES testExe2lib)
set_property(TARGET testExe2 PROPERTY INTERFACE_LINK_LIBRARIES testExe2lib)
add_library(compileOnly INTERFACE)
target_compile_definitions(compileOnly INTERFACE FROM_compileOnly)
@@ -36,7 +35,6 @@ target_link_libraries(noUses INTERFACE this::target_does_not_exist)
add_library(testLib1 STATIC testLib1.c)
add_library(testLib2 STATIC testLib2.c)
target_link_libraries(testLib2 testLib1)
target_link_libraries(testLib2
PRIVATE
testLib1
@@ -68,7 +66,6 @@ set_property(TARGET testLib3Imp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl)
target_link_libraries(testLib3Imp testLib3ImpDep)
add_library(testLib3 SHARED testLib3.c)
target_link_libraries(testLib3 testLib3Imp)
set_property(TARGET testLib3 PROPERTY LINK_INTERFACE_LIBRARIES "")
set_property(TARGET testLib3 PROPERTY VERSION 1.2)
set_property(TARGET testLib3 PROPERTY SOVERSION 3)
@@ -108,8 +105,6 @@ else()
set(maybe_OBJECTS_DESTINATION "")
endif()
cmake_policy(PUSH)
cmake_policy(SET CMP0022 NEW)
add_library(testLib9ObjPub OBJECT testLib9ObjPub.c)
target_compile_definitions(testLib9ObjPub INTERFACE testLib9ObjPub_USED)
add_library(testLib9ObjPriv OBJECT testLib9ObjPriv.c)
@@ -119,41 +114,37 @@ target_compile_definitions(testLib9ObjIface INTERFACE testLib9ObjIface_USED)
add_library(testLib9 STATIC testLib9.c)
target_link_libraries(testLib9 INTERFACE testLib9ObjIface PUBLIC testLib9ObjPub PRIVATE testLib9ObjPriv)
target_link_libraries(testLib9 PUBLIC Foo::Foo)
cmake_policy(POP)
block()
cmake_policy(SET CMP0022 NEW)
add_library(testLib10 STATIC testLib10.c)
set_target_properties(testLib10 PROPERTIES
TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_C"
TRANSITIVE_LINK_PROPERTIES "CUSTOM_L"
INTERFACE_CUSTOM_C "TESTLIB10_INTERFACE_CUSTOM_C"
INTERFACE_CUSTOM_L "TESTLIB10_INTERFACE_CUSTOM_L"
)
target_compile_definitions(testLib10 INTERFACE
"$<TARGET_PROPERTY:CUSTOM_C>"
"$<TARGET_PROPERTY:CUSTOM_L>"
)
add_library(testLib11 STATIC testLib11.c)
target_link_libraries(testLib11 PRIVATE testLib10)
set_target_properties(testLib11 PROPERTIES
INTERFACE_CUSTOM_C "TESTLIB11_INTERFACE_CUSTOM_C"
INTERFACE_CUSTOM_L "TESTLIB11_INTERFACE_CUSTOM_L"
TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_D"
TRANSITIVE_LINK_PROPERTIES "CUSTOM_M"
INTERFACE_CUSTOM_D "TESTLIB11_INTERFACE_CUSTOM_D"
INTERFACE_CUSTOM_M "TESTLIB11_INTERFACE_CUSTOM_M"
)
target_compile_definitions(testLib11 INTERFACE
"$<TARGET_PROPERTY:CUSTOM_C>"
"$<TARGET_PROPERTY:CUSTOM_D>"
"$<TARGET_PROPERTY:CUSTOM_L>"
"$<TARGET_PROPERTY:CUSTOM_M>"
)
endblock()
add_library(testLib10 STATIC testLib10.c)
set_target_properties(testLib10 PROPERTIES
TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_C"
TRANSITIVE_LINK_PROPERTIES "CUSTOM_L"
INTERFACE_CUSTOM_C "TESTLIB10_INTERFACE_CUSTOM_C"
INTERFACE_CUSTOM_L "TESTLIB10_INTERFACE_CUSTOM_L"
)
target_compile_definitions(testLib10 INTERFACE
"$<TARGET_PROPERTY:CUSTOM_C>"
"$<TARGET_PROPERTY:CUSTOM_L>"
)
add_library(testLib11 STATIC testLib11.c)
target_link_libraries(testLib11 PRIVATE testLib10)
set_target_properties(testLib11 PROPERTIES
INTERFACE_CUSTOM_C "TESTLIB11_INTERFACE_CUSTOM_C"
INTERFACE_CUSTOM_L "TESTLIB11_INTERFACE_CUSTOM_L"
TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_D"
TRANSITIVE_LINK_PROPERTIES "CUSTOM_M"
INTERFACE_CUSTOM_D "TESTLIB11_INTERFACE_CUSTOM_D"
INTERFACE_CUSTOM_M "TESTLIB11_INTERFACE_CUSTOM_M"
)
target_compile_definitions(testLib11 INTERFACE
"$<TARGET_PROPERTY:CUSTOM_C>"
"$<TARGET_PROPERTY:CUSTOM_D>"
"$<TARGET_PROPERTY:CUSTOM_L>"
"$<TARGET_PROPERTY:CUSTOM_M>"
)
# Test using the target_link_libraries command to set the
# LINK_INTERFACE_LIBRARIES* properties. We construct two libraries
# INTERFACE_LINK_LIBRARIES properties. We construct two libraries
# providing the same two symbols. In each library one of the symbols
# will work and the other one will fail to link. The import part of
# this test will try to use the symbol corresponding to the
@@ -166,7 +157,7 @@ set_property(TARGET testLib4libdbg PROPERTY COMPILE_DEFINITIONS LIB_DBG)
set_property(TARGET testLib4libopt PROPERTY COMPILE_DEFINITIONS LIB_OPT)
target_link_libraries(testLib4
LINK_INTERFACE_LIBRARIES
testLib4lib debug testLib4libdbg optimized testLib4libopt
testLib4lib debug $<TARGET_NAME:testLib4libdbg> optimized $<TARGET_NAME:testLib4libopt>
)
add_executable(testExe3 testExe3.c)
@@ -219,9 +210,6 @@ install(
DESTINATION include/testInterfaceIncludeUser
)
cmake_policy(PUSH)
cmake_policy(SET CMP0022 NEW)
# Test control over direct linking.
include(../../InterfaceLinkLibrariesDirect/testStaticLibPlugin.cmake)
include(../../InterfaceLinkLibrariesDirect/testSharedLibWithHelper.cmake)
@@ -237,10 +225,8 @@ add_library(testLibDepends testLibDepends.c)
target_link_libraries(testLibDepends LINK_PUBLIC testLibRequired)
add_library(testStaticLibRequiredPrivate testStaticLibRequiredPrivate.c)
target_link_libraries(testLibDepends PRIVATE testStaticLibRequiredPrivate)
cmake_policy(POP)
cmake_policy(PUSH)
cmake_policy(SET CMP0022 NEW)
cmake_policy(SET CMP0079 NEW)
add_library(TopDirLib STATIC testTopDirLib.c)
add_subdirectory(SubDirLinkA)
@@ -387,8 +373,6 @@ install(FILES
DESTINATION include/testSharedLibRequiredUser
)
cmake_policy(PUSH)
cmake_policy(SET CMP0022 NEW)
add_library(testSharedLibRequiredUser2 SHARED testSharedLibRequiredUser2.cpp)
generate_export_header(testSharedLibRequiredUser2)
set_property(TARGET testSharedLibRequiredUser2 APPEND PROPERTY
@@ -401,7 +385,6 @@ install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/testsharedlibrequireduser2_export.h"
DESTINATION include/testSharedLibRequiredUser2
)
cmake_policy(POP)
cmake_policy(PUSH)
cmake_policy(SET CMP0041 NEW)
@@ -426,28 +409,17 @@ set_property(TARGET testSharedLibDepends APPEND PROPERTY
)
cmake_policy(POP)
# LINK_PRIVATE because the LINK_INTERFACE_LIBRARIES is specified above.
target_link_libraries(testSharedLibDepends LINK_PRIVATE testSharedLibRequired)
target_link_libraries(testSharedLibDepends LINK_PUBLIC renamed_on_export)
target_link_libraries(testSharedLibDepends LINK_INTERFACE_LIBRARIES
target_link_libraries(testSharedLibDepends INTERFACE
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:$<TARGET_NAME:testSharedLibRequired>>)
cmake_policy(PUSH)
cmake_policy(SET CMP0022 OLD)
add_library(cmp0022OLD SHARED cmp0022_vs6_1.cpp)
generate_export_header(cmp0022OLD BASE_NAME cmp0022)
target_include_directories(cmp0022OLD PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/cmp0022>"
)
cmake_policy(SET CMP0022 NEW)
add_library(cmp0022NEW SHARED cmp0022_vs6_1.cpp)
set_property(TARGET cmp0022NEW PROPERTY DEFINE_SYMBOL cmp0022OLD_EXPORTS)
generate_export_header(cmp0022NEW BASE_NAME cmp0022)
target_include_directories(cmp0022NEW PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/cmp0022>"
)
cmake_policy(POP)
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/cmp0022.h"
"${CMAKE_CURRENT_BINARY_DIR}/cmp0022_export.h"
@@ -466,9 +438,6 @@ set_property(TARGET testLib4 PROPERTY
EXPORT_PROPERTIES EXPORTED_PROPERTY2 EXPORTED_PROPERTY3)
set_property(TARGET cmp0022NEW APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2)
# set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLibIncludeRequired2) # TODO: Test for error
set_property(TARGET cmp0022OLD APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2)
set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3)
add_library(noIncludesInterface empty.cpp)
@@ -622,7 +591,7 @@ install(
testSharedLibWithHelper testSharedLibHelperObj
testExeWithPluginHelper testExePluginHelperObj
testMod1 testMod2
cmp0022NEW cmp0022OLD
cmp0022NEW
TopDirLib SubDirLinkA
systemlib
testInterfaceIncludeUser
@@ -684,7 +653,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
testExe2libImp testLib3Imp testLib3ImpDep subdirlib
testSharedLibRequired testSharedLibRequiredUser testSharedLibRequiredUser2
testSharedLibDepends renamed_on_export
cmp0022NEW cmp0022OLD
cmp0022NEW
TopDirLib SubDirLinkA
systemlib noUses
testInterfaceIncludeUser
+2 -22
View File
@@ -186,13 +186,9 @@ if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG AND
endforeach()
endif()
add_executable(cmp0022OLD_test cmp0022OLD_test_vs6_1.cpp)
target_link_libraries(cmp0022OLD_test bld_cmp0022OLD)
add_executable(cmp0022NEW_test cmp0022NEW_test_vs6_1.cpp)
target_link_libraries(cmp0022NEW_test bld_cmp0022NEW)
add_executable(cmp0022OLD_exp_test cmp0022OLD_test_vs6_2.cpp)
target_link_libraries(cmp0022OLD_exp_test exp_cmp0022OLD)
add_executable(cmp0022NEW_exp_test cmp0022NEW_test_vs6_2.cpp)
target_link_libraries(cmp0022NEW_exp_test exp_cmp0022NEW)
@@ -427,32 +423,16 @@ target_link_libraries(iface_test_bld bld_testSharedLibDepends)
set_property(TARGET iface_test_bld PROPERTY NO_SYSTEM_FROM_IMPORTED 1)
set_property(TARGET bld_testSharedLibRequired APPEND PROPERTY
LINK_INTERFACE_LIBRARIES
INTERFACE_LINK_LIBRARIES
excludedFromAll
)
get_target_property(_configs bld_testSharedLibRequired IMPORTED_CONFIGURATIONS)
foreach(_config ${_configs})
set_property(TARGET bld_testSharedLibRequired APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
excludedFromAll
)
endforeach()
unset(_configs)
add_executable(iface_test_exp iface_test.cpp)
target_link_libraries(iface_test_exp testSharedLibDepends)
set_property(TARGET testSharedLibDepends APPEND PROPERTY
LINK_INTERFACE_LIBRARIES
INTERFACE_LINK_LIBRARIES
excludedFromAll
)
get_target_property(_configs testSharedLibDepends IMPORTED_CONFIGURATIONS)
foreach(_config ${_configs})
set_property(TARGET testSharedLibDepends APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
excludedFromAll
)
endforeach()
unset(_configs)
if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
OR CMAKE_C_COMPILER_ID MATCHES "LCC"
@@ -1,12 +0,0 @@
#ifdef USING_TESTLIB2
# error Unexpected USING_TESTLIB2
#endif
#ifndef USING_TESTLIB3
# error Expected USING_TESTLIB3
#endif
int main(void)
{
return 0;
}
@@ -1 +0,0 @@
#include "cmp0022OLD_test.cpp"
@@ -1 +0,0 @@
#include "cmp0022OLD_test.cpp"
@@ -12,11 +12,6 @@ set(CMAKE_FIND_USE_INSTALL_PREFIX OFF)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# Look for a package which uses FindPackageHandleStandardArgs.cmake with the
# new (as of cmake 2.8.3) syntax. This works only if CMP0017 is set to NEW,
# because otherwise FindPackageHandleStandardArgs.cmake from the current
# directory is included (via CMAKE_MODULE_PATH).
cmake_policy(SET CMP0017 NEW)
find_package(ZLIB QUIET)
# Look for a package that has a find module and may be found.
@@ -1,14 +0,0 @@
cmake_policy(SET CMP0021 OLD)
add_executable(cmp0021exe main.cpp)
if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/includes")
execute_process(COMMAND ${CMAKE_COMMAND} -E
copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/includes"
"${CMAKE_CURRENT_BINARY_DIR}/includes"
)
endif()
set_property(TARGET cmp0021exe PROPERTY
INCLUDE_DIRECTORIES includes/cmp0021)
@@ -1,2 +0,0 @@
#define CMP0021_DEFINE
-11
View File
@@ -1,11 +0,0 @@
#include "cmp0021.h"
#ifndef CMP0021_DEFINE
# error Expected CMP0021_DEFINE
#endif
int main(int, char**)
{
return 0;
}
-4
View File
@@ -206,7 +206,3 @@ get_target_property(incs empty_entry_test INCLUDE_DIRECTORIES)
if (NOT incs STREQUAL ";/one/two")
message(SEND_ERROR "Empty include_directories entry was not ignored.")
endif()
if(NOT CMAKE_GENERATOR STREQUAL "Xcode" AND NOT CMAKE_GENERATOR MATCHES "Ninja")
add_subdirectory(CMP0021)
endif()
@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.10)
cmake_policy(SET CMP0022 NEW)
project(InterfaceLinkLibraries)
add_library(foo_shared SHARED foo_vs6_1.cpp)
-6
View File
@@ -20,13 +20,7 @@ add_executable(myexe3 myexe.c)
set_property(TARGET myexe3 PROPERTY OUTPUT_NAME LinkDirectory3)
target_link_libraries(myexe3 PRIVATE mylibs)
# Test CMP0015 OLD behavior: -L../lib
cmake_policy(SET CMP0015 OLD)
link_directories(../lib${cfg_dir})
# Test CMP0015 NEW behavior: -L${CMAKE_CURRENT_SOURCE_DIR}/lib
cmake_policy(SET CMP0015 NEW)
link_directories(lib${cfg_dir})
add_executable(myexe myexe.c)
-2
View File
@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.10)
project(Qt4Targets)
cmake_policy(SET CMP0020 NEW)
find_package(Qt4 REQUIRED)
set(CMAKE_AUTOMOC ON)
-1
View File
@@ -1,2 +1 @@
cmake_policy(SET CMP0019 NEW)
include(CMP0019-code.cmake)
@@ -1,10 +0,0 @@
^CMake Deprecation Warning at CMP0019-OLD\.cmake:[0-9]+ \(cmake_policy\):
The OLD behavior for policy CMP0019 will be removed from a future version
of CMake\.
The cmake-policies\(7\) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)$
-2
View File
@@ -1,2 +0,0 @@
cmake_policy(SET CMP0019 OLD)
include(CMP0019-code.cmake)
@@ -1,40 +0,0 @@
^CMake Warning \(dev\) in CMakeLists\.txt:
Policy CMP0019 is not set: Do not re-expand variables in include and link
information. Run "cmake --help-policy CMP0019" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
The following variable evaluations were encountered:
Evaluated directory INCLUDE_DIRECTORIES
/usr/include/\${VAR_INCLUDE};/usr/include/normal
as
/usr/include/VAL_INCLUDE;/usr/include/normal
Evaluated target some_target INCLUDE_DIRECTORIES
/usr/include/\${VAR_INCLUDE};/usr/include/normal
as
/usr/include/VAL_INCLUDE;/usr/include/normal
Evaluated link directories
/usr/lib/\${VAR_LINK_DIRS};/usr/lib/normal
as
/usr/lib/VAL_LINK_DIRS;/usr/lib/normal
Evaluated link library
\${VAR_LINK_LIBS}
as
VAL_LINK_LIBS
This warning is for project developers. Use -Wno-dev to suppress it.$
@@ -1 +0,0 @@
include(CMP0019-code.cmake)
+2 -2
View File
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
include(${RunCMake_TEST}.cmake)
@@ -1,6 +1,3 @@
include(RunCMake)
set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
run_cmake(CMP0019-WARN)
run_cmake(CMP0019-OLD)
run_cmake(CMP0019-NEW)
@@ -1,7 +0,0 @@
enable_language(CXX)
add_library(testLib empty_vs6_1.cpp)
add_executable(testExe empty_vs6_2.cpp)
target_link_libraries(testExe testLib)
export(TARGETS testExe FILE "${CMAKE_CURRENT_BINARY_DIR}/cmp0022NOWARN-exe.cmake")
@@ -1,8 +1,6 @@
enable_language(CXX)
cmake_policy(SET CMP0022 NEW)
add_library(foo STATIC empty_vs6_1.cpp)
add_library(bar STATIC empty_vs6_2.cpp)
add_library(bat STATIC empty_vs6_3.cpp)
@@ -1 +0,0 @@
0
@@ -1,19 +0,0 @@
^CMake Warning \(dev\) in CMakeLists\.txt:
Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
interface. Run "cmake --help-policy CMP0022" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Target "bar" has an INTERFACE_LINK_LIBRARIES property. This should be
preferred as the source of the link interface for this library but because
CMP0022 is not set CMake is ignoring the property and using the link
implementation as the link interface instead.
INTERFACE_LINK_LIBRARIES:
foo
Link implementation:
\(empty\)
This warning is for project developers. Use -Wno-dev to suppress it.
@@ -1,10 +0,0 @@
enable_language(CXX)
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo)
add_library(user empty.cpp)
target_link_libraries(user bar)
@@ -1 +0,0 @@
0
@@ -1,19 +0,0 @@
CMake Warning \(dev\) in CMakeLists.txt:
Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
interface. Run "cmake --help-policy CMP0022" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Target "bar" has an INTERFACE_LINK_LIBRARIES property. This should be
preferred as the source of the link interface for this library but because
CMP0022 is not set CMake is ignoring the property and using the link
implementation as the link interface instead.
INTERFACE_LINK_LIBRARIES:
foo
Link implementation:
bat
This warning is for project developers. Use -Wno-dev to suppress it.$
@@ -1,11 +0,0 @@
enable_language(CXX)
add_library(foo STATIC empty_vs6_1.cpp)
add_library(bar STATIC empty_vs6_2.cpp)
add_library(bat STATIC empty_vs6_3.cpp)
set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo)
set_property(TARGET bar PROPERTY LINK_LIBRARIES bat)
add_library(user empty.cpp)
target_link_libraries(user bar)
@@ -1,17 +0,0 @@
^CMake Warning \(dev\) in CMakeLists\.txt:
Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
interface. Run "cmake --help-policy CMP0022" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from
its LINK_INTERFACE_LIBRARIES properties.
INTERFACE_LINK_LIBRARIES:
foo
LINK_INTERFACE_LIBRARIES:
bat
This warning is for project developers. Use -Wno-dev to suppress it.$
@@ -1 +0,0 @@
0
@@ -1,17 +0,0 @@
CMake Warning \(dev\) in CMakeLists.txt:
Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
interface. Run "cmake --help-policy CMP0022" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from
its LINK_INTERFACE_LIBRARIES(_DEBUG)? properties.
INTERFACE_LINK_LIBRARIES:
foo
LINK_INTERFACE_LIBRARIES(_DEBUG)?:
bat
This warning is for project developers. Use -Wno-dev to suppress it.
@@ -1,13 +0,0 @@
enable_language(CXX)
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
add_library(bat SHARED empty_vs6_3.cpp)
target_link_libraries(bar LINK_PUBLIC foo)
# Replace the compatibility values set by target_link_libraries
set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat)
set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES_DEBUG bat)
add_library(user SHARED empty.cpp)
target_link_libraries(user bar)
-18
View File
@@ -1,18 +0,0 @@
enable_language(CXX)
cmake_policy(SET CMP0042 NEW)
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
add_library(bat SHARED empty_vs6_3.cpp)
set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo)
set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat)
add_library(user empty.cpp)
target_link_libraries(user bar)
# Use "bar" again with a different "head" target to check
# that the warning does not appear again.
add_library(user2 empty_vs6_3.cpp)
target_link_libraries(user2 bar)
@@ -1,7 +1,5 @@
enable_language(CXX)
cmake_policy(SET CMP0022 NEW)
add_library(testLib empty_vs6_1.cpp)
add_executable(testExe empty_vs6_2.cpp)
target_link_libraries(testExe testLib)
@@ -1,8 +1,6 @@
enable_language(CXX)
cmake_policy(SET CMP0022 NEW)
add_library(cmp0022NEW SHARED empty_vs6_1.cpp)
add_library(testLib SHARED empty_vs6_2.cpp)
@@ -1,8 +1,6 @@
enable_language(CXX)
cmake_policy(SET CMP0022 NEW)
add_library(cmp0022NEW SHARED empty_vs6_1.cpp)
add_library(testLib SHARED empty_vs6_2.cpp)
+1 -1
View File
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
@@ -1,11 +1,5 @@
include(RunCMake)
set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
run_cmake(CMP0022-WARN)
run_cmake(CMP0022-WARN-tll)
run_cmake(CMP0022-WARN-static)
run_cmake(CMP0022-WARN-empty-old)
run_cmake(CMP0022-NOWARN-exe)
run_cmake(CMP0022-NOWARN-shared)
run_cmake(CMP0022-NOWARN-static)
run_cmake(CMP0022-NOWARN-static-NEW)
@@ -1,5 +1,3 @@
cmake_policy(SET CMP0022 NEW)
enable_language(C)
add_library(AnObjLib OBJECT a.c)
@@ -1,5 +1,3 @@
cmake_policy(SET CMP0022 NEW)
enable_language(C)
add_library(AnObjLib OBJECT a.c)
@@ -1,5 +1,5 @@
^CMake Error at BeforeVersionRemoved\.cmake:1 \(cmake_minimum_required\):
Compatibility with CMake < 2\.8\.0 has been removed from CMake\.
Compatibility with CMake < 2\.8\.12 has been removed from CMake\.
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
to tell CMake that the project requires at least <min> but has been updated
@@ -1 +1 @@
cmake_minimum_required(VERSION 2.6.4)
cmake_minimum_required(VERSION 2.8.11)
@@ -1,5 +1,5 @@
^CMake Error at PolicyBeforeVersionRemoved\.cmake:1 \(cmake_policy\):
Compatibility with CMake < 2\.8\.0 has been removed from CMake\.
Compatibility with CMake < 2\.8\.12 has been removed from CMake\.
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
to tell CMake that the project requires at least <min> but has been updated
@@ -1 +1 @@
cmake_policy(VERSION 2.6.4)
cmake_policy(VERSION 2.8.11)
@@ -1,7 +1,5 @@
enable_language(CXX)
cmake_policy(SET CMP0021 NEW)
add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>")
@@ -1,8 +1,5 @@
enable_language(CXX)
cmake_policy(SET CMP0022 NEW)
cmake_policy(SET CMP0023 NEW)
add_library(somelib empty.cpp)
# This test ensures that some internal mechanisms of cmGeneratorExpression
@@ -1,11 +1,11 @@
CMake Error at CMP0023-NEW-2.cmake:11 \(target_link_libraries\):
CMake Error at CMP0023-NEW-2.cmake:9 \(target_link_libraries\):
The plain signature for target_link_libraries has already been used with
the target "foo". All uses of target_link_libraries with a target must be
either all-keyword or all-plain.
The uses of the plain signature are here:
\* CMP0023-NEW-2.cmake:10 \(target_link_libraries\)
\* CMP0023-NEW-2.cmake:8 \(target_link_libraries\)
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
@@ -1,8 +1,6 @@
enable_language(CXX)
cmake_policy(SET CMP0023 NEW)
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
add_library(bat SHARED empty_vs6_3.cpp)
@@ -1,11 +1,11 @@
CMake Error at CMP0023-NEW.cmake:11 \(target_link_libraries\):
CMake Error at CMP0023-NEW.cmake:9 \(target_link_libraries\):
The plain signature for target_link_libraries has already been used with
the target "foo". All uses of target_link_libraries with a target must be
either all-keyword or all-plain.
The uses of the plain signature are here:
\* CMP0023-NEW.cmake:10 \(target_link_libraries\)
\* CMP0023-NEW.cmake:8 \(target_link_libraries\)
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
@@ -1,8 +1,6 @@
enable_language(CXX)
cmake_policy(SET CMP0023 NEW)
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
add_library(bat SHARED empty_vs6_3.cpp)
@@ -1,16 +0,0 @@
CMake Warning \(dev\) at CMP0023-WARN-2.cmake:9 \(target_link_libraries\):
Policy CMP0023 is not set: Plain and keyword target_link_libraries
signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
The plain signature for target_link_libraries has already been used with
the target "foo". All uses of target_link_libraries with a target should
be either all-keyword or all-plain.
The uses of the plain signature are here:
\* CMP0023-WARN-2.cmake:8 \(target_link_libraries\)
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
@@ -1,9 +0,0 @@
cmake_policy(VERSION 2.8.11)
enable_language(CXX)
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
add_library(bat SHARED empty_vs6_3.cpp)
target_link_libraries(foo bar)
target_link_libraries(foo LINK_PRIVATE bat)
@@ -1,16 +0,0 @@
CMake Warning \(dev\) at CMP0023-WARN.cmake:9 \(target_link_libraries\):
Policy CMP0023 is not set: Plain and keyword target_link_libraries
signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
The plain signature for target_link_libraries has already been used with
the target "foo". All uses of target_link_libraries with a target should
be either all-keyword or all-plain.
The uses of the plain signature are here:
\* CMP0023-WARN.cmake:8 \(target_link_libraries\)
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
@@ -1,9 +0,0 @@
cmake_policy(VERSION 2.8.11)
enable_language(CXX)
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
add_library(bat SHARED empty_vs6_3.cpp)
target_link_libraries(foo bar)
target_link_libraries(foo PRIVATE bat)
@@ -8,9 +8,7 @@ endif()
run_cmake(ConfigCase)
unset(RunCMake_TEST_OPTIONS)
run_cmake(CMP0023-WARN)
run_cmake(CMP0023-NEW)
run_cmake(CMP0023-WARN-2)
run_cmake(CMP0023-NEW-2)
run_cmake(CMP0079-iface-WARN)
run_cmake(CMP0079-iface-OLD)