Explorar el Código

CMP0023: Remove support for OLD behavior

Brad King hace 11 meses
padre
commit
0453f70400

+ 5 - 4
Help/policy/CMP0023.rst

@@ -1,6 +1,9 @@
 CMP0023
 -------
 
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
 Plain and keyword :command:`target_link_libraries` signatures cannot be mixed.
 
 CMake 2.8.12 introduced the :command:`target_link_libraries` signature using
@@ -29,7 +32,5 @@ this policy is to not to allow mixing of the keyword and plain
 signatures.
 
 .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt

+ 1 - 1
Source/cmPolicies.h

@@ -83,7 +83,7 @@ class cmMakefile;
   SELECT(                                                                     \
     POLICY, CMP0023,                                                          \
     "Plain and keyword target_link_libraries signatures cannot be mixed.", 2, \
-    8, 12, WARN)                                                              \
+    8, 12, NEW)                                                               \
   SELECT(POLICY, CMP0024, "Disallow include export result.", 3, 0, 0, WARN)   \
   SELECT(POLICY, CMP0025, "Compiler id for Apple Clang is now AppleClang.",   \
          3, 0, 0, WARN)                                                       \

+ 16 - 35
Source/cmTargetLinkLibrariesCommand.cxx

@@ -396,41 +396,22 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState,
   if (!this->Target->PushTLLCommandTrace(
         sig, this->Makefile.GetBacktrace().Top())) {
     std::ostringstream e;
-    const char* modal = nullptr;
-    MessageType messageType = MessageType::AUTHOR_WARNING;
-    switch (this->Makefile.GetPolicyStatus(cmPolicies::CMP0023)) {
-      case cmPolicies::WARN:
-        e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << '\n';
-        modal = "should";
-        CM_FALLTHROUGH;
-      case cmPolicies::OLD:
-        break;
-      case cmPolicies::NEW:
-        modal = "must";
-        messageType = MessageType::FATAL_ERROR;
-        break;
-    }
-
-    if (modal) {
-      // If the sig is a keyword form and there is a conflict, the existing
-      // form must be the plain form.
-      const char* existingSig =
-        (sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword");
-      e << "The " << existingSig
-        << " signature for target_link_libraries has "
-           "already been used with the target \""
-        << this->Target->GetName()
-        << "\".  All uses of target_link_libraries with a target " << modal
-        << " be either all-keyword or all-plain.\n";
-      this->Target->GetTllSignatureTraces(e,
-                                          sig == cmTarget::KeywordTLLSignature
-                                            ? cmTarget::PlainTLLSignature
-                                            : cmTarget::KeywordTLLSignature);
-      this->Makefile.IssueMessage(messageType, e.str());
-      if (messageType == MessageType::FATAL_ERROR) {
-        return false;
-      }
-    }
+    // If the sig is a keyword form and there is a conflict, the existing
+    // form must be the plain form.
+    const char* existingSig =
+      (sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword");
+    e << "The " << existingSig
+      << " signature for target_link_libraries has "
+         "already been used with the target \""
+      << this->Target->GetName()
+      << "\".  All uses of target_link_libraries with a target must "
+      << " be either all-keyword or all-plain.\n";
+    this->Target->GetTllSignatureTraces(e,
+                                        sig == cmTarget::KeywordTLLSignature
+                                          ? cmTarget::PlainTLLSignature
+                                          : cmTarget::KeywordTLLSignature);
+    this->Makefile.IssueMessage(MessageType::FATAL_ERROR, e.str());
+    return false;
   }
 
   // Handle normal case where the command was called with another keyword than

+ 0 - 2
Tests/RunCMake/include_directories/incomplete-genex.cmake

@@ -1,7 +1,5 @@
 enable_language(CXX)
 
-cmake_policy(SET CMP0023 NEW)
-
 add_library(somelib empty.cpp)
 
 # This test ensures that some internal mechanisms of cmGeneratorExpression

+ 2 - 2
Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt

@@ -1,11 +1,11 @@
-CMake Error at CMP0023-NEW-2.cmake:11 \(target_link_libraries\):
+CMake Error at CMP0023-NEW-2.cmake:9 \(target_link_libraries\):
   The plain signature for target_link_libraries has already been used with
   the target "foo".  All uses of target_link_libraries with a target must be
   either all-keyword or all-plain.
 
   The uses of the plain signature are here:
 
-   \* CMP0023-NEW-2.cmake:10 \(target_link_libraries\)
+   \* CMP0023-NEW-2.cmake:8 \(target_link_libraries\)
 
 Call Stack \(most recent call first\):
   CMakeLists\.txt:[0-9]+ \(include\)

+ 0 - 2
Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake

@@ -1,8 +1,6 @@
 
 enable_language(CXX)
 
-cmake_policy(SET CMP0023 NEW)
-
 add_library(foo SHARED empty_vs6_1.cpp)
 add_library(bar SHARED empty_vs6_2.cpp)
 add_library(bat SHARED empty_vs6_3.cpp)

+ 2 - 2
Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt

@@ -1,11 +1,11 @@
-CMake Error at CMP0023-NEW.cmake:11 \(target_link_libraries\):
+CMake Error at CMP0023-NEW.cmake:9 \(target_link_libraries\):
   The plain signature for target_link_libraries has already been used with
   the target "foo".  All uses of target_link_libraries with a target must be
   either all-keyword or all-plain.
 
   The uses of the plain signature are here:
 
-   \* CMP0023-NEW.cmake:10 \(target_link_libraries\)
+   \* CMP0023-NEW.cmake:8 \(target_link_libraries\)
 
 Call Stack \(most recent call first\):
   CMakeLists\.txt:[0-9]+ \(include\)

+ 0 - 2
Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake

@@ -1,8 +1,6 @@
 
 enable_language(CXX)
 
-cmake_policy(SET CMP0023 NEW)
-
 add_library(foo SHARED empty_vs6_1.cpp)
 add_library(bar SHARED empty_vs6_2.cpp)
 add_library(bat SHARED empty_vs6_3.cpp)

+ 0 - 16
Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt

@@ -1,16 +0,0 @@
-CMake Warning \(dev\) at CMP0023-WARN-2.cmake:9 \(target_link_libraries\):
-  Policy CMP0023 is not set: Plain and keyword target_link_libraries
-  signatures cannot be mixed.  Run "cmake --help-policy CMP0023" for policy
-  details.  Use the cmake_policy command to set the policy and suppress this
-  warning.
-
-  The plain signature for target_link_libraries has already been used with
-  the target "foo".  All uses of target_link_libraries with a target should
-  be either all-keyword or all-plain.
-
-  The uses of the plain signature are here:
-
-   \* CMP0023-WARN-2.cmake:8 \(target_link_libraries\)
-
-Call Stack \(most recent call first\):
-  CMakeLists\.txt:[0-9]+ \(include\)

+ 0 - 9
Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake

@@ -1,9 +0,0 @@
-cmake_policy(VERSION 2.8.11)
-enable_language(CXX)
-
-add_library(foo SHARED empty_vs6_1.cpp)
-add_library(bar SHARED empty_vs6_2.cpp)
-add_library(bat SHARED empty_vs6_3.cpp)
-
-target_link_libraries(foo bar)
-target_link_libraries(foo LINK_PRIVATE bat)

+ 0 - 16
Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt

@@ -1,16 +0,0 @@
-CMake Warning \(dev\) at CMP0023-WARN.cmake:9 \(target_link_libraries\):
-  Policy CMP0023 is not set: Plain and keyword target_link_libraries
-  signatures cannot be mixed.  Run "cmake --help-policy CMP0023" for policy
-  details.  Use the cmake_policy command to set the policy and suppress this
-  warning.
-
-  The plain signature for target_link_libraries has already been used with
-  the target "foo".  All uses of target_link_libraries with a target should
-  be either all-keyword or all-plain.
-
-  The uses of the plain signature are here:
-
-   \* CMP0023-WARN.cmake:8 \(target_link_libraries\)
-
-Call Stack \(most recent call first\):
-  CMakeLists\.txt:[0-9]+ \(include\)

+ 0 - 9
Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake

@@ -1,9 +0,0 @@
-cmake_policy(VERSION 2.8.11)
-enable_language(CXX)
-
-add_library(foo SHARED empty_vs6_1.cpp)
-add_library(bar SHARED empty_vs6_2.cpp)
-add_library(bat SHARED empty_vs6_3.cpp)
-
-target_link_libraries(foo bar)
-target_link_libraries(foo PRIVATE bat)

+ 0 - 2
Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake

@@ -8,9 +8,7 @@ endif()
 run_cmake(ConfigCase)
 unset(RunCMake_TEST_OPTIONS)
 
-run_cmake(CMP0023-WARN)
 run_cmake(CMP0023-NEW)
-run_cmake(CMP0023-WARN-2)
 run_cmake(CMP0023-NEW-2)
 run_cmake(CMP0079-iface-WARN)
 run_cmake(CMP0079-iface-OLD)