diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst index f912a22904..5d3f518de5 100644 --- a/Help/policy/CMP0037.rst +++ b/Help/policy/CMP0037.rst @@ -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 diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 711eaa53d8..61762d6492 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -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 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; } diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index 16a89651f2..2c7e3a0550 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -64,7 +64,8 @@ bool cmAddExecutableCommand(std::vector 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; } diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index e2a52d13ea..037ac03cdc 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -150,7 +150,8 @@ bool cmAddLibraryCommand(std::vector 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; } diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index be256471e9..496f12a137 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -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; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1046d939b2..491009ea7b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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; } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 8108678bc1..e993e10172 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -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); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d9a900c585..94184a6897 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7a47541034..e560a5d391 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -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; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index c3f8aa27c8..9acdb29db0 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -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.", \ diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt index ec2315f186..7f5458c625 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt @@ -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. diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake index fd56e7566b..13724ee439 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake @@ -1,5 +1,4 @@ enable_language(CXX) -cmake_policy(SET CMP0037 NEW) add_library("lib:colon" empty.cpp) add_executable("exe:colon" empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt index 5789e383aa..945786e9e1 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt @@ -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\): diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake index 83a7119090..a56c7f8b79 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake @@ -1,5 +1,4 @@ enable_language(CXX) -cmake_policy(SET CMP0037 NEW) add_library(all empty.cpp) add_executable(clean empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt index e14cec0009..61abe5b1de 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt @@ -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. diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake index 2a288cc999..e4819f3ee8 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake @@ -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) diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt deleted file mode 100644 index de093517e1..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt +++ /dev/null @@ -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\)$ diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake deleted file mode 100644 index f52e4d2d02..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake +++ /dev/null @@ -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) diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt deleted file mode 100644 index 4d13e59ef5..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt +++ /dev/null @@ -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\)$ diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake deleted file mode 100644 index c9fb6c8902..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake +++ /dev/null @@ -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") diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt deleted file mode 100644 index d3b0e172f5..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt +++ /dev/null @@ -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. diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake deleted file mode 100644 index 1b1a405e82..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake +++ /dev/null @@ -1,4 +0,0 @@ -enable_language(CXX) -add_library("lib:colon" empty.cpp) -add_executable("exe:colon" empty.cpp) -add_custom_target("custom:colon") diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt deleted file mode 100644 index 2d556a7e8e..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt +++ /dev/null @@ -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. diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake deleted file mode 100644 index a5e0f10dd0..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake +++ /dev/null @@ -1,4 +0,0 @@ -enable_language(CXX) -add_library(all empty.cpp) -add_executable(clean empty.cpp) -add_custom_target(help) diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt deleted file mode 100644 index e39477a91b..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt +++ /dev/null @@ -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\) diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake deleted file mode 100644 index e01b8e5ec4..0000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake +++ /dev/null @@ -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") diff --git a/Tests/RunCMake/CMP0037/CMakeLists.txt b/Tests/RunCMake/CMP0037/CMakeLists.txt index 4b3de84d94..bf2ef1506e 100644 --- a/Tests/RunCMake/CMP0037/CMakeLists.txt +++ b/Tests/RunCMake/CMP0037/CMakeLists.txt @@ -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) diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt b/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt index 270fa6db20..8f408bff09 100644 --- a/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt +++ b/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt @@ -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\)$ diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package.cmake b/Tests/RunCMake/CMP0037/NEW-cond-package.cmake index ceea90783a..93ae7a5808 100644 --- a/Tests/RunCMake/CMP0037/NEW-cond-package.cmake +++ b/Tests/RunCMake/CMP0037/NEW-cond-package.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0037 NEW) file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "") add_custom_target(test) add_custom_target(package) diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt b/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt index 2d321473b6..85a678ea1e 100644 --- a/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt +++ b/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt @@ -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\): diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake b/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake index 3f8883b3d4..834570747c 100644 --- a/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake +++ b/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0037 NEW) file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "") add_custom_target(test) add_custom_target(package) diff --git a/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt b/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt index 44b4741ea3..c7cbdf4365 100644 --- a/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt +++ b/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt @@ -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\)$ diff --git a/Tests/RunCMake/CMP0037/NEW-cond-test.cmake b/Tests/RunCMake/CMP0037/NEW-cond-test.cmake index 7eeaffcc39..dba32156c9 100644 --- a/Tests/RunCMake/CMP0037/NEW-cond-test.cmake +++ b/Tests/RunCMake/CMP0037/NEW-cond-test.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0037 NEW) enable_testing() add_custom_target(test) add_custom_target(package) diff --git a/Tests/RunCMake/CMP0037/NEW-cond.cmake b/Tests/RunCMake/CMP0037/NEW-cond.cmake index d0dc77af39..0bfdbe12c0 100644 --- a/Tests/RunCMake/CMP0037/NEW-cond.cmake +++ b/Tests/RunCMake/CMP0037/NEW-cond.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0037 NEW) add_custom_target(test) add_custom_target(package) add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt deleted file mode 100644 index 5a29a49c34..0000000000 --- a/Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt +++ /dev/null @@ -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\)$ diff --git a/Tests/RunCMake/CMP0037/OLD-cond-package.cmake b/Tests/RunCMake/CMP0037/OLD-cond-package.cmake deleted file mode 100644 index 7a0afbe105..0000000000 --- a/Tests/RunCMake/CMP0037/OLD-cond-package.cmake +++ /dev/null @@ -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) diff --git a/Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt deleted file mode 100644 index 5f72e1675e..0000000000 --- a/Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt +++ /dev/null @@ -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\)$ diff --git a/Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake b/Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake deleted file mode 100644 index 95616b6850..0000000000 --- a/Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake +++ /dev/null @@ -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) diff --git a/Tests/RunCMake/CMP0037/OLD-cond-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-stderr.txt deleted file mode 100644 index 94e4575c0a..0000000000 --- a/Tests/RunCMake/CMP0037/OLD-cond-stderr.txt +++ /dev/null @@ -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\)$ diff --git a/Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt deleted file mode 100644 index 81e10ce42a..0000000000 --- a/Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt +++ /dev/null @@ -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\)$ diff --git a/Tests/RunCMake/CMP0037/OLD-cond-test.cmake b/Tests/RunCMake/CMP0037/OLD-cond-test.cmake deleted file mode 100644 index bfa32a954e..0000000000 --- a/Tests/RunCMake/CMP0037/OLD-cond-test.cmake +++ /dev/null @@ -1,5 +0,0 @@ -cmake_policy(SET CMP0037 OLD) -enable_testing() -add_custom_target(test) -add_custom_target(package) -add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/OLD-cond.cmake b/Tests/RunCMake/CMP0037/OLD-cond.cmake deleted file mode 100644 index abad680539..0000000000 --- a/Tests/RunCMake/CMP0037/OLD-cond.cmake +++ /dev/null @@ -1,5 +0,0 @@ -cmake_policy(SET CMP0037 OLD) - -add_custom_target(test) -add_custom_target(package) -add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake index 89beb59634..d6efdb28c6 100644 --- a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake @@ -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() diff --git a/Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt b/Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt deleted file mode 100644 index 5960e51496..0000000000 --- a/Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt +++ /dev/null @@ -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.$ diff --git a/Tests/RunCMake/CMP0037/WARN-cond-package.cmake b/Tests/RunCMake/CMP0037/WARN-cond-package.cmake deleted file mode 100644 index 61cdc68343..0000000000 --- a/Tests/RunCMake/CMP0037/WARN-cond-package.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "") -add_custom_target(test) -add_custom_target(package) -add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt b/Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt deleted file mode 100644 index ae729092b2..0000000000 --- a/Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt +++ /dev/null @@ -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.$ diff --git a/Tests/RunCMake/CMP0037/WARN-cond-package_source.cmake b/Tests/RunCMake/CMP0037/WARN-cond-package_source.cmake deleted file mode 100644 index 468380c365..0000000000 --- a/Tests/RunCMake/CMP0037/WARN-cond-package_source.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "") -add_custom_target(test) -add_custom_target(package) -add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt b/Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt deleted file mode 100644 index e7a3ee5945..0000000000 --- a/Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt +++ /dev/null @@ -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.$ diff --git a/Tests/RunCMake/CMP0037/WARN-cond-test.cmake b/Tests/RunCMake/CMP0037/WARN-cond-test.cmake deleted file mode 100644 index 982af369e8..0000000000 --- a/Tests/RunCMake/CMP0037/WARN-cond-test.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -enable_testing() -add_custom_target(test) -add_custom_target(package) -add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/WARN-cond.cmake b/Tests/RunCMake/CMP0037/WARN-cond.cmake deleted file mode 100644 index 04a7f9da26..0000000000 --- a/Tests/RunCMake/CMP0037/WARN-cond.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -add_custom_target(test) -add_custom_target(package) -add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/alias-test-NEW.cmake b/Tests/RunCMake/CMP0037/alias-test-NEW.cmake index 32569b5474..bb880a34b6 100644 --- a/Tests/RunCMake/CMP0037/alias-test-NEW.cmake +++ b/Tests/RunCMake/CMP0037/alias-test-NEW.cmake @@ -1,2 +1 @@ -cmake_policy(SET CMP0037 NEW) include(alias-test-common.cmake) diff --git a/Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt b/Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt deleted file mode 100644 index bf177e2db1..0000000000 --- a/Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt +++ /dev/null @@ -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\)$ diff --git a/Tests/RunCMake/CMP0037/alias-test-OLD.cmake b/Tests/RunCMake/CMP0037/alias-test-OLD.cmake deleted file mode 100644 index 1f3e770871..0000000000 --- a/Tests/RunCMake/CMP0037/alias-test-OLD.cmake +++ /dev/null @@ -1,2 +0,0 @@ -cmake_policy(SET CMP0037 OLD) -include(alias-test-common.cmake) diff --git a/Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt b/Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt deleted file mode 100644 index 43bf98b8cf..0000000000 --- a/Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt +++ /dev/null @@ -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\) diff --git a/Tests/RunCMake/CMP0037/alias-test-WARN.cmake b/Tests/RunCMake/CMP0037/alias-test-WARN.cmake deleted file mode 100644 index 688cb95f37..0000000000 --- a/Tests/RunCMake/CMP0037/alias-test-WARN.cmake +++ /dev/null @@ -1,2 +0,0 @@ -# leave CMP0037 unset -include(alias-test-common.cmake) diff --git a/Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt b/Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt index e14fcdedb0..a48bded714 100644 --- a/Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt +++ b/Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt @@ -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\)$ diff --git a/Tests/RunCMake/InterfaceLibrary/invalid_name.cmake b/Tests/RunCMake/InterfaceLibrary/invalid_name.cmake index 4a8ca37ba1..3c9a90a34b 100644 --- a/Tests/RunCMake/InterfaceLibrary/invalid_name.cmake +++ b/Tests/RunCMake/InterfaceLibrary/invalid_name.cmake @@ -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) diff --git a/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt b/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt index f352457a8f..f3e7d05196 100644 --- a/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt +++ b/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt @@ -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\) diff --git a/Tests/RunCMake/alias_targets/invalid-name-stderr.txt b/Tests/RunCMake/alias_targets/invalid-name-stderr.txt index d33b57c105..006ef3745b 100644 --- a/Tests/RunCMake/alias_targets/invalid-name-stderr.txt +++ b/Tests/RunCMake/alias_targets/invalid-name-stderr.txt @@ -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\)$ diff --git a/Tests/RunCMake/alias_targets/invalid-name.cmake b/Tests/RunCMake/alias_targets/invalid-name.cmake index e2ebbfa05f..13e939c0c6 100644 --- a/Tests/RunCMake/alias_targets/invalid-name.cmake +++ b/Tests/RunCMake/alias_targets/invalid-name.cmake @@ -1,6 +1,3 @@ -cmake_policy(SET CMP0037 OLD) enable_language(CXX) - add_library(foo empty.cpp) - add_library(invalid$name ALIAS foo) diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt index 0e106a47f5..be6154c1be 100644 --- a/Tests/VSResource/CMakeLists.txt +++ b/Tests/VSResource/CMakeLists.txt @@ -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()