mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-23 07:28:51 -06:00
CMP0037: Remove support for OLD behavior
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
CMP0037
|
||||
-------
|
||||
|
||||
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
|
||||
.. include:: REMOVED_PROLOGUE.txt
|
||||
|
||||
Target names should not be reserved and should match a validity pattern.
|
||||
|
||||
CMake 2.8.12 and lower allowed creating targets using :command:`add_library`,
|
||||
@@ -28,7 +31,5 @@ The ``NEW`` behavior for this policy is to report an error
|
||||
if an add_* command is used with an invalid target name.
|
||||
|
||||
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
|
||||
.. |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
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmStateTypes.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmTarget.h"
|
||||
@@ -163,23 +162,11 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
|
||||
}
|
||||
}
|
||||
|
||||
std::string::size_type pos = targetName.find_first_of("#<>");
|
||||
if (pos != std::string::npos) {
|
||||
status.SetError(cmStrCat("called with target name containing a \"",
|
||||
targetName[pos],
|
||||
"\". This character is not allowed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Some requirements on custom target names already exist
|
||||
// and have been checked at this point.
|
||||
// The following restrictions overlap but depend on policy CMP0037.
|
||||
bool nameOk = cmGeneratorExpression::IsValidTargetName(targetName) &&
|
||||
!cmGlobalGenerator::IsReservedTarget(targetName);
|
||||
if (nameOk) {
|
||||
nameOk = targetName.find(':') == std::string::npos;
|
||||
}
|
||||
if (!nameOk && !mf.CheckCMP0037(targetName, cmStateEnums::UTILITY)) {
|
||||
!cmGlobalGenerator::IsReservedTarget(targetName) &&
|
||||
targetName.find(':') == std::string::npos;
|
||||
if (!nameOk) {
|
||||
mf.IssueInvalidTargetNameError(targetName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,8 @@ bool cmAddExecutableCommand(std::vector<std::string> const& args,
|
||||
if (nameOk && !importTarget && !isAlias) {
|
||||
nameOk = exename.find(':') == std::string::npos;
|
||||
}
|
||||
if (!nameOk && !mf.CheckCMP0037(exename, cmStateEnums::EXECUTABLE)) {
|
||||
if (!nameOk) {
|
||||
mf.IssueInvalidTargetNameError(exename);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
|
||||
if (nameOk && !importTarget && !isAlias) {
|
||||
nameOk = libName.find(':') == std::string::npos;
|
||||
}
|
||||
if (!nameOk && !mf.CheckCMP0037(libName, type)) {
|
||||
if (!nameOk) {
|
||||
mf.IssueInvalidTargetNameError(libName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -703,12 +703,6 @@ Json::Value CodemodelConfig::DumpTarget(cmGeneratorTarget* gt,
|
||||
{
|
||||
Target t(gt, this->Config);
|
||||
std::string prefix = "target-" + gt->GetName();
|
||||
for (char& c : prefix) {
|
||||
// CMP0037 OLD behavior allows slashes in target names. Remove them.
|
||||
if (c == '/' || c == '\\') {
|
||||
c = '_';
|
||||
}
|
||||
}
|
||||
if (!this->Config.empty()) {
|
||||
prefix += "-" + this->Config;
|
||||
}
|
||||
|
||||
@@ -2726,58 +2726,38 @@ cmGlobalGenerator::SplitFrameworkPath(const std::string& path,
|
||||
return cm::nullopt;
|
||||
}
|
||||
|
||||
static bool RaiseCMP0037Message(cmake* cm, cmTarget* tgt,
|
||||
std::string const& targetNameAsWritten,
|
||||
std::string const& reason)
|
||||
namespace {
|
||||
void IssueReservedTargetNameError(cmake* cm, cmTarget* tgt,
|
||||
std::string const& targetNameAsWritten,
|
||||
std::string const& reason)
|
||||
{
|
||||
MessageType messageType = MessageType::AUTHOR_WARNING;
|
||||
std::ostringstream e;
|
||||
bool issueMessage = false;
|
||||
switch (tgt->GetPolicyStatusCMP0037()) {
|
||||
case cmPolicies::WARN:
|
||||
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << '\n';
|
||||
issueMessage = true;
|
||||
CM_FALLTHROUGH;
|
||||
case cmPolicies::OLD:
|
||||
break;
|
||||
case cmPolicies::NEW:
|
||||
issueMessage = true;
|
||||
messageType = MessageType::FATAL_ERROR;
|
||||
break;
|
||||
}
|
||||
if (issueMessage) {
|
||||
e << "The target name \"" << targetNameAsWritten << "\" is reserved "
|
||||
<< reason << '.';
|
||||
if (messageType == MessageType::AUTHOR_WARNING) {
|
||||
e << " It may result in undefined behavior.";
|
||||
}
|
||||
cm->IssueMessage(messageType, e.str(), tgt->GetBacktrace());
|
||||
if (messageType == MessageType::FATAL_ERROR) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
cm->IssueMessage(MessageType::FATAL_ERROR,
|
||||
cmStrCat("The target name \"", targetNameAsWritten,
|
||||
"\" is reserved ", reason, '.'),
|
||||
tgt->GetBacktrace());
|
||||
}
|
||||
}
|
||||
|
||||
bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
|
||||
std::string const& reason) const
|
||||
bool cmGlobalGenerator::CheckReservedTargetName(
|
||||
std::string const& targetName, std::string const& reason) const
|
||||
{
|
||||
cmTarget* tgt = this->FindTarget(targetName);
|
||||
if (!tgt) {
|
||||
return true;
|
||||
}
|
||||
return RaiseCMP0037Message(this->GetCMakeInstance(), tgt, targetName,
|
||||
reason);
|
||||
IssueReservedTargetNameError(this->GetCMakeInstance(), tgt, targetName,
|
||||
reason);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cmGlobalGenerator::CheckCMP0037Prefix(std::string const& targetPrefix,
|
||||
std::string const& reason) const
|
||||
bool cmGlobalGenerator::CheckReservedTargetNamePrefix(
|
||||
std::string const& targetPrefix, std::string const& reason) const
|
||||
{
|
||||
bool ret = true;
|
||||
for (auto const& tgtPair : this->TargetSearchIndex) {
|
||||
if (cmHasPrefix(tgtPair.first, targetPrefix) &&
|
||||
!RaiseCMP0037Message(this->GetCMakeInstance(), tgtPair.second,
|
||||
tgtPair.first, reason)) {
|
||||
if (cmHasPrefix(tgtPair.first, targetPrefix)) {
|
||||
IssueReservedTargetNameError(this->GetCMakeInstance(), tgtPair.second,
|
||||
tgtPair.first, reason);
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
@@ -2807,7 +2787,8 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
|
||||
|
||||
static const auto reservedTargets = { "package", "PACKAGE" };
|
||||
for (auto const& target : reservedTargets) {
|
||||
if (!this->CheckCMP0037(target, "when CPack packaging is enabled")) {
|
||||
if (!this->CheckReservedTargetName(target,
|
||||
"when CPack packaging is enabled")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2856,8 +2837,8 @@ void cmGlobalGenerator::AddGlobalTarget_PackageSource(
|
||||
|
||||
static const auto reservedTargets = { "package_source" };
|
||||
for (auto const& target : reservedTargets) {
|
||||
if (!this->CheckCMP0037(target,
|
||||
"when CPack source packaging is enabled")) {
|
||||
if (!this->CheckReservedTargetName(
|
||||
target, "when CPack source packaging is enabled")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2886,7 +2867,8 @@ void cmGlobalGenerator::AddGlobalTarget_Test(
|
||||
|
||||
static const auto reservedTargets = { "test", "RUN_TESTS" };
|
||||
for (auto const& target : reservedTargets) {
|
||||
if (!this->CheckCMP0037(target, "when CTest testing is enabled")) {
|
||||
if (!this->CheckReservedTargetName(target,
|
||||
"when CTest testing is enabled")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3245,14 +3227,14 @@ bool cmGlobalGenerator::AddBuildDatabaseTargets()
|
||||
|
||||
static const auto reservedTargets = { "cmake_build_database" };
|
||||
for (auto const& target : reservedTargets) {
|
||||
if (!this->CheckCMP0037(target,
|
||||
"when exporting build databases are enabled")) {
|
||||
if (!this->CheckReservedTargetName(
|
||||
target, "when exporting build databases are enabled")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
static const auto reservedPrefixes = { "cmake_build_database-" };
|
||||
for (auto const& prefix : reservedPrefixes) {
|
||||
if (!this->CheckCMP0037Prefix(
|
||||
if (!this->CheckReservedTargetNamePrefix(
|
||||
prefix, "when exporting build databases are enabled")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -875,10 +875,10 @@ private:
|
||||
|
||||
void ClearGeneratorMembers();
|
||||
|
||||
bool CheckCMP0037(std::string const& targetName,
|
||||
std::string const& reason) const;
|
||||
bool CheckCMP0037Prefix(std::string const& targetPrefix,
|
||||
std::string const& reason) const;
|
||||
bool CheckReservedTargetName(std::string const& targetName,
|
||||
std::string const& reason) const;
|
||||
bool CheckReservedTargetNamePrefix(std::string const& targetPrefix,
|
||||
std::string const& reason) const;
|
||||
|
||||
void IndexMakefile(cmMakefile* mf);
|
||||
void IndexLocalGenerator(cmLocalGenerator* lg);
|
||||
|
||||
@@ -195,39 +195,15 @@ Message::LogLevel cmMakefile::GetCurrentLogLevel() const
|
||||
return result;
|
||||
}
|
||||
|
||||
bool cmMakefile::CheckCMP0037(std::string const& targetName,
|
||||
cmStateEnums::TargetType targetType) const
|
||||
void cmMakefile::IssueInvalidTargetNameError(
|
||||
std::string const& targetName) const
|
||||
{
|
||||
MessageType messageType = MessageType::AUTHOR_WARNING;
|
||||
std::string e;
|
||||
bool issueMessage = false;
|
||||
switch (this->GetPolicyStatus(cmPolicies::CMP0037)) {
|
||||
case cmPolicies::WARN:
|
||||
if (targetType != cmStateEnums::INTERFACE_LIBRARY) {
|
||||
e = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0037), '\n');
|
||||
issueMessage = true;
|
||||
}
|
||||
CM_FALLTHROUGH;
|
||||
case cmPolicies::OLD:
|
||||
break;
|
||||
case cmPolicies::NEW:
|
||||
issueMessage = true;
|
||||
messageType = MessageType::FATAL_ERROR;
|
||||
break;
|
||||
}
|
||||
if (issueMessage) {
|
||||
e +=
|
||||
cmStrCat("The target name \"", targetName,
|
||||
"\" is reserved or not valid for certain "
|
||||
"CMake features, such as generator expressions, and may result "
|
||||
"in undefined behavior.");
|
||||
this->IssueMessage(messageType, e);
|
||||
|
||||
if (messageType == MessageType::FATAL_ERROR) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
this->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("The target name \"", targetName,
|
||||
"\" is reserved or not valid for certain "
|
||||
"CMake features, such as generator expressions, and may result "
|
||||
"in undefined behavior."));
|
||||
}
|
||||
|
||||
void cmMakefile::MaybeWarnCMP0074(std::string const& rootVar, cmValue rootDef,
|
||||
|
||||
@@ -994,8 +994,7 @@ public:
|
||||
/** Set whether or not to report a CMP0000 violation. */
|
||||
void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
|
||||
|
||||
bool CheckCMP0037(std::string const& targetName,
|
||||
cmStateEnums::TargetType targetType) const;
|
||||
void IssueInvalidTargetNameError(std::string const& targetName) const;
|
||||
|
||||
cmBTStringRange GetIncludeDirectoriesEntries() const;
|
||||
cmBTStringRange GetCompileOptionsEntries() const;
|
||||
|
||||
@@ -117,7 +117,7 @@ class cmMakefile;
|
||||
SELECT(POLICY, CMP0037, \
|
||||
"Target names should not be reserved and should match a validity " \
|
||||
"pattern.", \
|
||||
3, 0, 0, WARN) \
|
||||
3, 0, 0, NEW) \
|
||||
SELECT(POLICY, CMP0038, "Targets may not link directly to themselves.", 3, \
|
||||
0, 0, WARN) \
|
||||
SELECT(POLICY, CMP0039, "Utility targets may not have link dependencies.", \
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
CMake Error at CMP0037-NEW-colon.cmake:4 \(add_library\):
|
||||
CMake Error at CMP0037-NEW-colon.cmake:[0-9]+ \(add_library\):
|
||||
The target name "lib:colon" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Error at CMP0037-NEW-colon.cmake:5 \(add_executable\):
|
||||
CMake Error at CMP0037-NEW-colon.cmake:[0-9]+ \(add_executable\):
|
||||
The target name "exe:colon" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Error at CMP0037-NEW-colon.cmake:6 \(add_custom_target\):
|
||||
CMake Error at CMP0037-NEW-colon.cmake:[0-9]+ \(add_custom_target\):
|
||||
The target name "custom:colon" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
enable_language(CXX)
|
||||
cmake_policy(SET CMP0037 NEW)
|
||||
|
||||
add_library("lib:colon" empty.cpp)
|
||||
add_executable("exe:colon" empty.cpp)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
CMake Error at CMP0037-NEW-reserved.cmake:4 \(add_library\):
|
||||
CMake Error at CMP0037-NEW-reserved.cmake:[0-9]+ \(add_library\):
|
||||
The target name "all" is reserved or not valid for certain CMake features,
|
||||
such as generator expressions, and may result in undefined behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Error at CMP0037-NEW-reserved.cmake:5 \(add_executable\):
|
||||
CMake Error at CMP0037-NEW-reserved.cmake:[0-9]+ \(add_executable\):
|
||||
The target name "clean" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Error at CMP0037-NEW-reserved.cmake:6 \(add_custom_target\):
|
||||
CMake Error at CMP0037-NEW-reserved.cmake:[0-9]+ \(add_custom_target\):
|
||||
The target name "help" is reserved or not valid for certain CMake features,
|
||||
such as generator expressions, and may result in undefined behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
enable_language(CXX)
|
||||
cmake_policy(SET CMP0037 NEW)
|
||||
|
||||
add_library(all empty.cpp)
|
||||
add_executable(clean empty.cpp)
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
CMake Error at CMP0037-NEW-space.cmake:4 \(add_library\):
|
||||
CMake Error at CMP0037-NEW-space.cmake:[0-9]+ \(add_library\):
|
||||
The target name "lib with spaces" is reserved or not valid for certain
|
||||
CMake features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Error at CMP0037-NEW-space.cmake:5 \(add_executable\):
|
||||
CMake Error at CMP0037-NEW-space.cmake:[0-9]+ \(add_executable\):
|
||||
The target name "exe with spaces" is reserved or not valid for certain
|
||||
CMake features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Error at CMP0037-NEW-space.cmake:6 \(add_custom_target\):
|
||||
CMake Error at CMP0037-NEW-space.cmake:[0-9]+ \(add_custom_target\):
|
||||
The target name "custom with spaces" is reserved or not valid for certain
|
||||
CMake features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
enable_language(CXX)
|
||||
cmake_policy(SET CMP0037 NEW)
|
||||
|
||||
add_library("lib with spaces" empty.cpp)
|
||||
add_executable("exe with spaces" empty.cpp)
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
^CMake Deprecation Warning at CMP0037-OLD-reserved.cmake:2 \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0037 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:3 \(include\)$
|
||||
@@ -1,6 +0,0 @@
|
||||
enable_language(CXX)
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
|
||||
add_library(all empty.cpp)
|
||||
add_executable(clean empty.cpp)
|
||||
add_custom_target(help)
|
||||
@@ -1,10 +0,0 @@
|
||||
^CMake Deprecation Warning at CMP0037-OLD-space.cmake:2 \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0037 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:3 \(include\)$
|
||||
@@ -1,6 +0,0 @@
|
||||
enable_language(CXX)
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
|
||||
add_library("lib with spaces" empty.cpp)
|
||||
add_executable("exe with spaces" empty.cpp)
|
||||
add_custom_target("custom with spaces")
|
||||
@@ -1 +0,0 @@
|
||||
0
|
||||
@@ -1,38 +0,0 @@
|
||||
CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:2 \(add_library\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "lib:colon" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
+
|
||||
CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:3 \(add_executable\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "exe:colon" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
+
|
||||
CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:4 \(add_custom_target\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "custom:colon" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
@@ -1,4 +0,0 @@
|
||||
enable_language(CXX)
|
||||
add_library("lib:colon" empty.cpp)
|
||||
add_executable("exe:colon" empty.cpp)
|
||||
add_custom_target("custom:colon")
|
||||
@@ -1,36 +0,0 @@
|
||||
CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:2 \(add_library\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "all" is reserved or not valid for certain CMake features,
|
||||
such as generator expressions, and may result in undefined behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
+
|
||||
CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:3 \(add_executable\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "clean" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
+
|
||||
CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:4 \(add_custom_target\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "help" is reserved or not valid for certain CMake features,
|
||||
such as generator expressions, and may result in undefined behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
@@ -1,4 +0,0 @@
|
||||
enable_language(CXX)
|
||||
add_library(all empty.cpp)
|
||||
add_executable(clean empty.cpp)
|
||||
add_custom_target(help)
|
||||
@@ -1 +0,0 @@
|
||||
0
|
||||
@@ -1,37 +0,0 @@
|
||||
CMake Warning \(dev\) at CMP0037-WARN-space.cmake:2 \(add_library\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "lib with spaces" is reserved or not valid for certain
|
||||
CMake features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
+
|
||||
CMake Warning \(dev\) at CMP0037-WARN-space.cmake:3 \(add_executable\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "exe with spaces" is reserved or not valid for certain
|
||||
CMake features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
+
|
||||
CMake Warning \(dev\) at CMP0037-WARN-space.cmake:4 \(add_custom_target\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "custom with spaces" is reserved or not valid for certain
|
||||
CMake features, such as generator expressions, and may result in undefined
|
||||
behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
@@ -1,4 +0,0 @@
|
||||
enable_language(CXX)
|
||||
add_library("lib with spaces" empty.cpp)
|
||||
add_executable("exe with spaces" empty.cpp)
|
||||
add_custom_target("custom with spaces")
|
||||
@@ -1,3 +1,3 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
^CMake Error at NEW-cond-package.cmake:4 \(add_custom_target\):
|
||||
^CMake Error at NEW-cond-package.cmake:[0-9]+ \(add_custom_target\):
|
||||
The target name "package" is reserved when CPack packaging is enabled.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)$
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
cmake_policy(SET CMP0037 NEW)
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "")
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
^CMake Error at NEW-cond-package_source.cmake:5 \(add_custom_target\):
|
||||
^CMake Error at NEW-cond-package_source.cmake:[0-9]+ \(add_custom_target\):
|
||||
The target name "package_source" is reserved when CPack source packaging is
|
||||
enabled.
|
||||
Call Stack \(most recent call first\):
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
cmake_policy(SET CMP0037 NEW)
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "")
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
^CMake Error at NEW-cond-test.cmake:3 \(add_custom_target\):
|
||||
^CMake Error at NEW-cond-test.cmake:[0-9]+ \(add_custom_target\):
|
||||
The target name "test" is reserved when CTest testing is enabled.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)$
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
cmake_policy(SET CMP0037 NEW)
|
||||
enable_testing()
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
cmake_policy(SET CMP0037 NEW)
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
add_custom_target(package_source)
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
^CMake Deprecation Warning at OLD-cond-package.cmake:1 \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0037 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:3 \(include\)$
|
||||
@@ -1,5 +0,0 @@
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "")
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
add_custom_target(package_source)
|
||||
@@ -1,10 +0,0 @@
|
||||
^CMake Deprecation Warning at OLD-cond-package_source.cmake:1 \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0037 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:3 \(include\)$
|
||||
@@ -1,5 +0,0 @@
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "")
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
add_custom_target(package_source)
|
||||
@@ -1,10 +0,0 @@
|
||||
^CMake Deprecation Warning at OLD-cond.cmake:1 \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0037 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:3 \(include\)$
|
||||
@@ -1,10 +0,0 @@
|
||||
^CMake Deprecation Warning at OLD-cond-test.cmake:1 \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0037 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:3 \(include\)$
|
||||
@@ -1,5 +0,0 @@
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
enable_testing()
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
add_custom_target(package_source)
|
||||
@@ -1,5 +0,0 @@
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
add_custom_target(package_source)
|
||||
@@ -1,56 +1,16 @@
|
||||
include(RunCMake)
|
||||
set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
|
||||
|
||||
if(RunCMake_GENERATOR MATCHES "^Ninja")
|
||||
# Detect ninja version so we know what tests can be supported.
|
||||
execute_process(
|
||||
COMMAND "${RunCMake_MAKE_PROGRAM}" --version
|
||||
OUTPUT_VARIABLE ninja_out
|
||||
ERROR_VARIABLE ninja_out
|
||||
RESULT_VARIABLE ninja_res
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(ninja_res EQUAL 0 AND "x${ninja_out}" MATCHES "^x[0-9]+\\.[0-9]+")
|
||||
set(ninja_version "${ninja_out}")
|
||||
message(STATUS "ninja version: ${ninja_version}")
|
||||
else()
|
||||
message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}")
|
||||
endif()
|
||||
else()
|
||||
set(ninja_version "")
|
||||
endif()
|
||||
|
||||
run_cmake(CMP0037-OLD-space)
|
||||
run_cmake(CMP0037-NEW-space)
|
||||
run_cmake(CMP0037-WARN-space)
|
||||
run_cmake(CMP0037-NEW-colon)
|
||||
|
||||
if(NOT (WIN32 AND "${RunCMake_GENERATOR}" MATCHES "Make"))
|
||||
run_cmake(CMP0037-WARN-colon)
|
||||
endif()
|
||||
|
||||
if(NOT ninja_version VERSION_GREATER_EQUAL 1.10)
|
||||
run_cmake(CMP0037-WARN-reserved)
|
||||
run_cmake(CMP0037-OLD-reserved)
|
||||
endif()
|
||||
run_cmake(CMP0037-NEW-reserved)
|
||||
|
||||
run_cmake(NEW-cond)
|
||||
run_cmake(NEW-cond-test)
|
||||
run_cmake(NEW-cond-package)
|
||||
run_cmake(OLD-cond)
|
||||
run_cmake(OLD-cond-test)
|
||||
run_cmake(OLD-cond-package)
|
||||
run_cmake(WARN-cond)
|
||||
run_cmake(WARN-cond-test)
|
||||
run_cmake(WARN-cond-package)
|
||||
|
||||
run_cmake(alias-test-NEW)
|
||||
run_cmake(alias-test-OLD)
|
||||
run_cmake(alias-test-WARN)
|
||||
|
||||
if(RunCMake_GENERATOR MATCHES "Make|Ninja")
|
||||
run_cmake(NEW-cond-package_source)
|
||||
run_cmake(OLD-cond-package_source)
|
||||
run_cmake(WARN-cond-package_source)
|
||||
endif()
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
^CMake Warning \(dev\) at WARN-cond-package.cmake:4 \(add_custom_target\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "package" is reserved when CPack packaging is enabled. It
|
||||
may result in undefined behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.$
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "")
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
add_custom_target(package_source)
|
||||
@@ -1,11 +0,0 @@
|
||||
^CMake Warning \(dev\) at WARN-cond-package_source.cmake:5 \(add_custom_target\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "package_source" is reserved when CPack source packaging is
|
||||
enabled. It may result in undefined behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.$
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "")
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
add_custom_target(package_source)
|
||||
@@ -1,11 +0,0 @@
|
||||
^CMake Warning \(dev\) at WARN-cond-test.cmake:3 \(add_custom_target\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
|
||||
details. Use the cmake_policy command to set the policy and suppress this
|
||||
warning.
|
||||
|
||||
The target name "test" is reserved when CTest testing is enabled. It may
|
||||
result in undefined behavior.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.$
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
enable_testing()
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
add_custom_target(package_source)
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
add_custom_target(test)
|
||||
add_custom_target(package)
|
||||
add_custom_target(package_source)
|
||||
@@ -1,2 +1 @@
|
||||
cmake_policy(SET CMP0037 NEW)
|
||||
include(alias-test-common.cmake)
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
^CMake Deprecation Warning at alias-test-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0037 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\)$
|
||||
@@ -1,2 +0,0 @@
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
include(alias-test-common.cmake)
|
||||
@@ -1,11 +0,0 @@
|
||||
^CMake Warning \(dev\) at alias-test-common\.cmake:[0-9]+ \(add_library\):
|
||||
Policy CMP0037 is not set: Target names should not be reserved and should
|
||||
match a validity pattern\. Run "cmake --help-policy CMP0037" for policy
|
||||
details\. Use the cmake_policy command to set the policy and suppress this
|
||||
warning\.
|
||||
|
||||
The target name "test" is reserved when CTest testing is enabled\. It may
|
||||
result in undefined behavior\.
|
||||
Call Stack \(most recent call first\):
|
||||
alias-test-WARN\.cmake:[0-9]+ \(include\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
@@ -1,2 +0,0 @@
|
||||
# leave CMP0037 unset
|
||||
include(alias-test-common.cmake)
|
||||
@@ -1,15 +1,20 @@
|
||||
CMake Error at invalid_name.cmake:2 \(add_library\):
|
||||
add_library Invalid name for INTERFACE library target: if\$ace
|
||||
^CMake Error at invalid_name\.cmake:1 \(add_library\):
|
||||
The target name "if\$ace" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
+
|
||||
CMake Error at invalid_name.cmake:4 \(add_library\):
|
||||
add_library Invalid name for INTERFACE library target: iface::target
|
||||
CMake Error at invalid_name\.cmake:2 \(add_library\):
|
||||
The target name "iface::target" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
+
|
||||
CMake Error at invalid_name.cmake:6 \(add_library\):
|
||||
add_library Invalid name for IMPORTED INTERFACE library target:
|
||||
if\$target_imported
|
||||
CMake Error at invalid_name\.cmake:3 \(add_library\):
|
||||
The target name "if\$target_imported" is reserved or not valid for certain
|
||||
CMake features, such as generator expressions, and may result in undefined
|
||||
behavior\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
add_library(if$ace INTERFACE)
|
||||
|
||||
add_library(iface::target INTERFACE)
|
||||
|
||||
add_library(if$target_imported INTERFACE IMPORTED)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
CMake Error at BadTargetName.cmake:1 \(add_custom_target\):
|
||||
add_custom_target called with target name containing a "#". This character
|
||||
is not allowed.
|
||||
The target name "#" is reserved or not valid for certain CMake features,
|
||||
such as generator expressions, and may result in undefined behavior\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Error at BadTargetName.cmake:2 \(add_custom_target\):
|
||||
add_custom_target called with target name containing a "<". This character
|
||||
is not allowed.
|
||||
The target name "<" is reserved or not valid for certain CMake features,
|
||||
such as generator expressions, and may result in undefined behavior\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Error at BadTargetName.cmake:3 \(add_custom_target\):
|
||||
add_custom_target called with target name containing a ">". This character
|
||||
is not allowed.
|
||||
The target name ">" is reserved or not valid for certain CMake features,
|
||||
such as generator expressions, and may result in undefined behavior\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
CMake Error at invalid-name.cmake:6 \(add_library\):
|
||||
add_library Invalid name for ALIAS: invalid\$name
|
||||
^CMake Error at invalid-name\.cmake:3 \(add_library\):
|
||||
The target name "invalid\$name" is reserved or not valid for certain CMake
|
||||
features, such as generator expressions, and may result in undefined
|
||||
behavior\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
enable_language(CXX)
|
||||
|
||||
add_library(foo empty.cpp)
|
||||
|
||||
add_library(invalid$name ALIAS foo)
|
||||
|
||||
@@ -56,10 +56,3 @@ endif()
|
||||
|
||||
set_property(TARGET VSResource
|
||||
PROPERTY VS_GLOBAL_CMakeTestVsGlobalVariable "test val")
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Ninja|Visual Studio")
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
add_library("My ResourceLib" lib.cpp lib.rc)
|
||||
cmake_policy(POP)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user