Переглянути джерело

CMP0028: Remove support for OLD behavior

Brad King 11 місяців тому
батько
коміт
84b7c9f5dd

+ 5 - 4
Help/policy/CMP0028.rst

@@ -1,6 +1,9 @@
 CMP0028
 -------
 
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
 Double colon in target name means ``ALIAS`` or ``IMPORTED`` target.
 
 CMake 2.8.12 and lower allowed the use of targets and files with double
@@ -21,7 +24,5 @@ for this policy is to issue a ``FATAL_ERROR`` if a link dependency contains
 double-colons but is not an ``IMPORTED`` target or an ``ALIAS`` target.
 
 .. |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

+ 2 - 15
Source/cmGeneratorTarget_Link.cxx

@@ -443,20 +443,7 @@ bool cmGeneratorTarget::VerifyLinkItemColons(LinkItemRole role,
       item.AsStr().find("::") == std::string::npos) {
     return true;
   }
-  MessageType messageType = MessageType::FATAL_ERROR;
   std::string e;
-  switch (this->GetLocalGenerator()->GetPolicyStatus(cmPolicies::CMP0028)) {
-    case cmPolicies::WARN: {
-      e = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0028), "\n");
-      messageType = MessageType::AUTHOR_WARNING;
-    } break;
-    case cmPolicies::OLD:
-      return true;
-    case cmPolicies::NEW:
-      // Issue the fatal message.
-      break;
-  }
-
   if (role == LinkItemRole::Implementation) {
     e = cmStrCat(e, "Target \"", this->GetName(), "\" links to");
   } else {
@@ -470,8 +457,8 @@ bool cmGeneratorTarget::VerifyLinkItemColons(LinkItemRole role,
   if (backtrace.Empty()) {
     backtrace = this->GetBacktrace();
   }
-  this->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(messageType, e,
-                                                              backtrace);
+  this->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
+    MessageType::FATAL_ERROR, e, backtrace);
   return false;
 }
 

+ 1 - 1
Source/cmPolicies.h

@@ -95,7 +95,7 @@ class cmMakefile;
          3, 0, 0, NEW)                                                        \
   SELECT(POLICY, CMP0028,                                                     \
          "Double colon in target name means ALIAS or IMPORTED target.", 3, 0, \
-         0, WARN)                                                             \
+         0, NEW)                                                              \
   SELECT(POLICY, CMP0029, "The subdir_depends command should not be called.", \
          3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0030,                                                     \

+ 0 - 2
Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt

@@ -1,5 +1,3 @@
-cmake_policy(SET CMP0028 NEW)
-
 include(GenerateExportHeader)
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 

+ 0 - 1
Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface-result.txt

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

+ 0 - 18
Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface-stderr.txt

@@ -1,18 +0,0 @@
-^CMake Deprecation Warning at CMakeLists\.txt:3 \(cmake_minimum_required\):
-  Compatibility with CMake < 3\.10 will be removed from a future version of
-  CMake\.
-
-  Update the VERSION argument <min> value\.  Or, use the <min>\.\.\.<max> syntax
-  to tell CMake that the project requires at least <min> but has been updated
-  to work with policies introduced by <max> or earlier\.
-+
-CMake Deprecation Warning at CMP0028-OLD-iface\.cmake:[0-9]+ \(cmake_policy\):
-  The OLD behavior for policy CMP0028 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 - 7
Tests/RunCMake/LinkItemValidation/CMP0028-OLD-iface.cmake

@@ -1,7 +0,0 @@
-
-cmake_policy(SET CMP0028 OLD)
-
-add_library(iface INTERFACE)
-target_link_libraries(iface INTERFACE External::Library)
-add_library(foo empty.cpp)
-target_link_libraries(foo iface)

+ 0 - 1
Tests/RunCMake/LinkItemValidation/CMP0028-OLD-result.txt

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

+ 0 - 18
Tests/RunCMake/LinkItemValidation/CMP0028-OLD-stderr.txt

@@ -1,18 +0,0 @@
-^CMake Deprecation Warning at CMakeLists\.txt:3 \(cmake_minimum_required\):
-  Compatibility with CMake < 3\.10 will be removed from a future version of
-  CMake\.
-
-  Update the VERSION argument <min> value\.  Or, use the <min>\.\.\.<max> syntax
-  to tell CMake that the project requires at least <min> but has been updated
-  to work with policies introduced by <max> or earlier\.
-+
-CMake Deprecation Warning at CMP0028-OLD\.cmake:[0-9]+ \(cmake_policy\):
-  The OLD behavior for policy CMP0028 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 - 5
Tests/RunCMake/LinkItemValidation/CMP0028-OLD.cmake

@@ -1,5 +0,0 @@
-
-cmake_policy(SET CMP0028 OLD)
-
-add_library(foo empty.cpp)
-target_link_libraries(foo PRIVATE External::Library)

+ 0 - 1
Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface-result.txt

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

+ 0 - 17
Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface-stderr.txt

@@ -1,17 +0,0 @@
-CMake Warning \(dev\) at CMP0028-WARN-iface\.cmake:3 \(target_link_libraries\):
-  Policy CMP0028 is not set: Double colon in target name means ALIAS or
-  IMPORTED target.  Run "cmake --help-policy CMP0028" for policy details.
-  Use the cmake_policy command to set the policy and suppress this warning.
-
-  The link interface of target "iface" contains:
-
-    External::Library
-
-  but the target was not found.  Possible reasons include:
-(
-    \*[^
-]+)*
-
-Call Stack \(most recent call first\):
-  CMakeLists\.txt:[0-9]+ \(include\)
-This warning is for project developers.  Use -Wno-dev to suppress it.

+ 0 - 5
Tests/RunCMake/LinkItemValidation/CMP0028-WARN-iface.cmake

@@ -1,5 +0,0 @@
-
-add_library(iface INTERFACE)
-target_link_libraries(iface INTERFACE External::Library)
-add_library(foo empty.cpp)
-target_link_libraries(foo iface)

+ 0 - 1
Tests/RunCMake/LinkItemValidation/CMP0028-WARN-result.txt

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

+ 0 - 17
Tests/RunCMake/LinkItemValidation/CMP0028-WARN-stderr.txt

@@ -1,17 +0,0 @@
-CMake Warning \(dev\) at CMP0028-WARN\.cmake:3 \(target_link_libraries\):
-  Policy CMP0028 is not set: Double colon in target name means ALIAS or
-  IMPORTED target.  Run "cmake --help-policy CMP0028" for policy details.
-  Use the cmake_policy command to set the policy and suppress this warning.
-
-  Target "foo" links to:
-
-    External::Library
-
-  but the target was not found.  Possible reasons include:
-(
-    \*[^
-]+)*
-
-Call Stack \(most recent call first\):
-  CMakeLists\.txt:[0-9]+ \(include\)
-This warning is for project developers.  Use -Wno-dev to suppress it.

+ 0 - 3
Tests/RunCMake/LinkItemValidation/CMP0028-WARN.cmake

@@ -1,3 +0,0 @@
-
-add_library(foo empty.cpp)
-target_link_libraries(foo PRIVATE External::Library)

+ 0 - 3
Tests/RunCMake/LinkItemValidation/CMakeLists.txt

@@ -1,6 +1,3 @@
 cmake_minimum_required(VERSION 3.10)
-if(RunCMake_TEST MATCHES "^CMP0028")
-  cmake_minimum_required(VERSION 2.8.12) # old enough to not set CMP0028
-endif()
 project(${RunCMake_TEST} CXX)
 include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) # policy used at end of dir

+ 0 - 4
Tests/RunCMake/LinkItemValidation/RunCMakeTest.cmake

@@ -1,10 +1,6 @@
 include(RunCMake)
 
 run_cmake(CMP0028-NEW)
-run_cmake(CMP0028-OLD)
-run_cmake(CMP0028-WARN)
 run_cmake(CMP0028-NEW-iface)
-run_cmake(CMP0028-OLD-iface)
-run_cmake(CMP0028-WARN-iface)
 
 run_cmake(OnlyTargets)

+ 1 - 1
Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt

@@ -1,4 +1,4 @@
-^CMake Error at CMP0079-link-NEW-bogus\.cmake:6 \(set_property\):
+^CMake Error at CMP0079-link-NEW-bogus\.cmake:[0-9]+ \(set_property\):
   Target "top" links to:
 
     ::@\(0xdeadbeef\)

+ 0 - 1
Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake

@@ -1,4 +1,3 @@
-cmake_policy(SET CMP0028 NEW)
 cmake_policy(SET CMP0079 NEW)
 enable_language(C)