CMP0002: Remove support for OLD behavior

This commit is contained in:
Brad King
2024-11-06 15:34:18 -05:00
parent 03a215643d
commit 136528aa1b
7 changed files with 6 additions and 29 deletions
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0002
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Logical target names must be globally unique.
Targets names created with :command:`add_executable`, :command:`add_library`, or
@@ -22,7 +25,5 @@ must simply have globally unique names (unless one uses the global
property :prop_gbl:`ALLOW_DUPLICATE_CUSTOM_TARGETS` with a Makefiles generator).
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.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
-11
View File
@@ -4396,17 +4396,6 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
"\" because an imported target with the same name already exists.");
return false;
}
// target names must be globally unique
switch (this->GetPolicyStatus(cmPolicies::CMP0002)) {
case cmPolicies::WARN:
this->IssueMessage(MessageType::AUTHOR_WARNING,
cmPolicies::GetPolicyWarning(cmPolicies::CMP0002));
CM_FALLTHROUGH;
case cmPolicies::OLD:
return true;
case cmPolicies::NEW:
break;
}
// The conflict is with a non-imported target.
// Allow this if the user has requested support.
+1 -1
View File
@@ -20,7 +20,7 @@ class cmMakefile;
"CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", 2, 6, 0, \
NEW) \
SELECT(POLICY, CMP0002, "Logical target names must be globally unique.", 2, \
6, 0, WARN) \
6, 0, NEW) \
SELECT( \
POLICY, CMP0003, \
"Libraries linked via full path no longer produce linker search paths.", \
-3
View File
@@ -545,9 +545,6 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(CrossCompile CrossCompile)
set_tests_properties(CrossCompile PROPERTIES
PASS_REGULAR_EXPRESSION "try_run.. invoked in cross-compiling mode")
if("${CMAKE_GENERATOR}" MATCHES "Make")
ADD_TEST_MACRO(Policy0002 Policy0002)
endif()
if(CMake_TEST_XCODE_VERSION)
set(Architecture_BUILD_OPTIONS -DCMake_TEST_XCODE_VERSION=${CMake_TEST_XCODE_VERSION})
ADD_TEST_MACRO(Architecture Architecture)
-1
View File
@@ -1 +0,0 @@
add_executable(Policy0002 ../policy0002.c)
-5
View File
@@ -1,5 +0,0 @@
cmake_minimum_required(VERSION 3.10)
project(Policy0002 C)
cmake_policy(SET CMP0002 OLD)
add_subdirectory(A)
add_executable(Policy0002 policy0002.c)
-4
View File
@@ -1,4 +0,0 @@
int main(void)
{
return 0;
}