Browse Source

CMP0037: Remove support for OLD behavior

Brad King 10 months ago
parent
commit
84f737545f
63 changed files with 95 additions and 502 deletions
  1. 5 4
      Help/policy/CMP0037.rst
  2. 4 17
      Source/cmAddCustomTargetCommand.cxx
  3. 2 1
      Source/cmAddExecutableCommand.cxx
  4. 2 1
      Source/cmAddLibraryCommand.cxx
  5. 0 6
      Source/cmFileAPICodemodel.cxx
  6. 28 46
      Source/cmGlobalGenerator.cxx
  7. 4 4
      Source/cmGlobalGenerator.h
  8. 9 33
      Source/cmMakefile.cxx
  9. 1 2
      Source/cmMakefile.h
  10. 1 1
      Source/cmPolicies.h
  11. 3 3
      Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt
  12. 0 1
      Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake
  13. 3 3
      Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt
  14. 0 1
      Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake
  15. 3 3
      Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt
  16. 0 1
      Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake
  17. 0 10
      Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt
  18. 0 6
      Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake
  19. 0 10
      Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt
  20. 0 6
      Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake
  21. 0 1
      Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt
  22. 0 38
      Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt
  23. 0 4
      Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake
  24. 0 36
      Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt
  25. 0 4
      Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake
  26. 0 1
      Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt
  27. 0 37
      Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt
  28. 0 4
      Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake
  29. 1 1
      Tests/RunCMake/CMP0037/CMakeLists.txt
  30. 1 1
      Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt
  31. 0 1
      Tests/RunCMake/CMP0037/NEW-cond-package.cmake
  32. 1 1
      Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt
  33. 0 1
      Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake
  34. 1 1
      Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt
  35. 0 1
      Tests/RunCMake/CMP0037/NEW-cond-test.cmake
  36. 0 1
      Tests/RunCMake/CMP0037/NEW-cond.cmake
  37. 0 10
      Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt
  38. 0 5
      Tests/RunCMake/CMP0037/OLD-cond-package.cmake
  39. 0 10
      Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt
  40. 0 5
      Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake
  41. 0 10
      Tests/RunCMake/CMP0037/OLD-cond-stderr.txt
  42. 0 10
      Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt
  43. 0 5
      Tests/RunCMake/CMP0037/OLD-cond-test.cmake
  44. 0 5
      Tests/RunCMake/CMP0037/OLD-cond.cmake
  45. 0 40
      Tests/RunCMake/CMP0037/RunCMakeTest.cmake
  46. 0 11
      Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt
  47. 0 5
      Tests/RunCMake/CMP0037/WARN-cond-package.cmake
  48. 0 11
      Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt
  49. 0 5
      Tests/RunCMake/CMP0037/WARN-cond-package_source.cmake
  50. 0 11
      Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt
  51. 0 5
      Tests/RunCMake/CMP0037/WARN-cond-test.cmake
  52. 0 4
      Tests/RunCMake/CMP0037/WARN-cond.cmake
  53. 0 1
      Tests/RunCMake/CMP0037/alias-test-NEW.cmake
  54. 0 10
      Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt
  55. 0 2
      Tests/RunCMake/CMP0037/alias-test-OLD.cmake
  56. 0 11
      Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt
  57. 0 2
      Tests/RunCMake/CMP0037/alias-test-WARN.cmake
  58. 15 10
      Tests/RunCMake/InterfaceLibrary/invalid_name-stderr.txt
  59. 0 3
      Tests/RunCMake/InterfaceLibrary/invalid_name.cmake
  60. 6 6
      Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt
  61. 5 3
      Tests/RunCMake/alias_targets/invalid-name-stderr.txt
  62. 0 3
      Tests/RunCMake/alias_targets/invalid-name.cmake
  63. 0 7
      Tests/VSResource/CMakeLists.txt

+ 5 - 4
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

+ 4 - 17
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<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;
   }
 

+ 2 - 1
Source/cmAddExecutableCommand.cxx

@@ -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;
   }
 

+ 2 - 1
Source/cmAddLibraryCommand.cxx

@@ -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;
   }
 

+ 0 - 6
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;
   }

+ 28 - 46
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;
     }

+ 4 - 4
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);

+ 9 - 33
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
-{
-  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;
+void cmMakefile::IssueInvalidTargetNameError(
+  std::string const& targetName) const
+{
+  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,

+ 1 - 2
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;

+ 1 - 1
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.",  \

+ 3 - 3
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.

+ 0 - 1
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)

+ 3 - 3
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\):

+ 0 - 1
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)

+ 3 - 3
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.

+ 0 - 1
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)

+ 0 - 10
Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt

@@ -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\)$

+ 0 - 6
Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake

@@ -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)

+ 0 - 10
Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt

@@ -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\)$

+ 0 - 6
Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake

@@ -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")

+ 0 - 1
Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt

@@ -1 +0,0 @@
-0

+ 0 - 38
Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt

@@ -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.

+ 0 - 4
Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake

@@ -1,4 +0,0 @@
-enable_language(CXX)
-add_library("lib:colon" empty.cpp)
-add_executable("exe:colon" empty.cpp)
-add_custom_target("custom:colon")

+ 0 - 36
Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt

@@ -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.

+ 0 - 4
Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake

@@ -1,4 +0,0 @@
-enable_language(CXX)
-add_library(all empty.cpp)
-add_executable(clean empty.cpp)
-add_custom_target(help)

+ 0 - 1
Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt

@@ -1 +0,0 @@
-0

+ 0 - 37
Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt

@@ -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\)

+ 0 - 4
Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake

@@ -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 - 1
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)

+ 1 - 1
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\)$

+ 0 - 1
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)

+ 1 - 1
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\):

+ 0 - 1
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)

+ 1 - 1
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\)$

+ 0 - 1
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)

+ 0 - 1
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)

+ 0 - 10
Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt

@@ -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\)$

+ 0 - 5
Tests/RunCMake/CMP0037/OLD-cond-package.cmake

@@ -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)

+ 0 - 10
Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt

@@ -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\)$

+ 0 - 5
Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake

@@ -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)

+ 0 - 10
Tests/RunCMake/CMP0037/OLD-cond-stderr.txt

@@ -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\)$

+ 0 - 10
Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt

@@ -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\)$

+ 0 - 5
Tests/RunCMake/CMP0037/OLD-cond-test.cmake

@@ -1,5 +0,0 @@
-cmake_policy(SET CMP0037 OLD)
-enable_testing()
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)

+ 0 - 5
Tests/RunCMake/CMP0037/OLD-cond.cmake

@@ -1,5 +0,0 @@
-cmake_policy(SET CMP0037 OLD)
-
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)

+ 0 - 40
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()

+ 0 - 11
Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt

@@ -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.$

+ 0 - 5
Tests/RunCMake/CMP0037/WARN-cond-package.cmake

@@ -1,5 +0,0 @@
-
-file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "")
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)

+ 0 - 11
Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt

@@ -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.$

+ 0 - 5
Tests/RunCMake/CMP0037/WARN-cond-package_source.cmake

@@ -1,5 +0,0 @@
-
-file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "")
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)

+ 0 - 11
Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt

@@ -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.$

+ 0 - 5
Tests/RunCMake/CMP0037/WARN-cond-test.cmake

@@ -1,5 +0,0 @@
-
-enable_testing()
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)

+ 0 - 4
Tests/RunCMake/CMP0037/WARN-cond.cmake

@@ -1,4 +0,0 @@
-
-add_custom_target(test)
-add_custom_target(package)
-add_custom_target(package_source)

+ 0 - 1
Tests/RunCMake/CMP0037/alias-test-NEW.cmake

@@ -1,2 +1 @@
-cmake_policy(SET CMP0037 NEW)
 include(alias-test-common.cmake)

+ 0 - 10
Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt

@@ -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\)$

+ 0 - 2
Tests/RunCMake/CMP0037/alias-test-OLD.cmake

@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0037 OLD)
-include(alias-test-common.cmake)

+ 0 - 11
Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt

@@ -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\)

+ 0 - 2
Tests/RunCMake/CMP0037/alias-test-WARN.cmake

@@ -1,2 +0,0 @@
-# leave CMP0037 unset
-include(alias-test-common.cmake)

+ 15 - 10
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\)$

+ 0 - 3
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)

+ 6 - 6
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\)

+ 5 - 3
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\)$

+ 0 - 3
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)

+ 0 - 7
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()