CMP0038: Remove support for OLD behavior
This commit is contained in:
parent
84f737545f
commit
af28f030d8
@ -1,6 +1,9 @@
|
||||
CMP0038
|
||||
-------
|
||||
|
||||
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
|
||||
.. include:: REMOVED_PROLOGUE.txt
|
||||
|
||||
Targets may not link directly to themselves.
|
||||
|
||||
CMake 2.8.12 and lower allowed a build target to link to itself directly with
|
||||
@ -12,7 +15,5 @@ in their own link implementation. The ``NEW`` behavior for this policy is to
|
||||
report an error if a target attempts to link to itself.
|
||||
|
||||
.. |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
|
||||
|
@ -1189,31 +1189,12 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
||||
}
|
||||
if (name == this->GetName() || name.empty()) {
|
||||
if (name == this->GetName()) {
|
||||
bool noMessage = false;
|
||||
MessageType messageType = MessageType::FATAL_ERROR;
|
||||
std::ostringstream e;
|
||||
switch (this->GetPolicyStatusCMP0038()) {
|
||||
case cmPolicies::WARN: {
|
||||
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0038) << "\n";
|
||||
messageType = MessageType::AUTHOR_WARNING;
|
||||
} break;
|
||||
case cmPolicies::OLD:
|
||||
noMessage = true;
|
||||
break;
|
||||
case cmPolicies::NEW:
|
||||
// Issue the fatal message.
|
||||
break;
|
||||
}
|
||||
|
||||
if (!noMessage) {
|
||||
e << "Target \"" << this->GetName() << "\" links to itself.";
|
||||
this->LocalGenerator->GetCMakeInstance()->IssueMessage(
|
||||
messageType, e.str(), this->GetBacktrace());
|
||||
if (messageType == MessageType::FATAL_ERROR) {
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("Target \"", this->GetName(), "\" links to itself."),
|
||||
this->GetBacktrace());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ class cmMakefile;
|
||||
"pattern.", \
|
||||
3, 0, 0, NEW) \
|
||||
SELECT(POLICY, CMP0038, "Targets may not link directly to themselves.", 3, \
|
||||
0, 0, WARN) \
|
||||
0, 0, NEW) \
|
||||
SELECT(POLICY, CMP0039, "Utility targets may not have link dependencies.", \
|
||||
3, 0, 0, WARN) \
|
||||
SELECT(POLICY, CMP0040, \
|
||||
|
@ -1,4 +1,4 @@
|
||||
CMake Error at CMP0038-NEW.cmake:3 \(add_library\):
|
||||
CMake Error at CMP0038-NEW.cmake:1 \(add_library\):
|
||||
Target "self_link" links to itself.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
|
@ -1,4 +1,2 @@
|
||||
|
||||
cmake_policy(SET CMP0038 NEW)
|
||||
add_library(self_link empty.cpp)
|
||||
target_link_libraries(self_link self_link)
|
||||
|
@ -1,10 +0,0 @@
|
||||
^CMake Deprecation Warning at CMP0038-OLD.cmake:2 \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0038 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\)$
|
@ -1,4 +0,0 @@
|
||||
|
||||
cmake_policy(SET CMP0038 OLD)
|
||||
add_library(self_link empty.cpp)
|
||||
target_link_libraries(self_link self_link)
|
@ -1 +0,0 @@
|
||||
0
|
@ -1,9 +0,0 @@
|
||||
CMake Warning \(dev\) at CMP0038-WARN.cmake:2 \(add_library\):
|
||||
Policy CMP0038 is not set: Targets may not link directly to themselves.
|
||||
Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy
|
||||
command to set the policy and suppress this warning.
|
||||
|
||||
Target "self_link" links to itself.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
@ -1,3 +0,0 @@
|
||||
|
||||
add_library(self_link empty.cpp)
|
||||
target_link_libraries(self_link self_link)
|
@ -1,3 +1,3 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(${RunCMake_TEST} CXX)
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
|
@ -1,6 +1,3 @@
|
||||
include(RunCMake)
|
||||
set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
|
||||
|
||||
run_cmake(CMP0038-WARN)
|
||||
run_cmake(CMP0038-NEW)
|
||||
run_cmake(CMP0038-OLD)
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
cmake_policy (SET CMP0038 NEW)
|
||||
cmake_policy (SET CMP0042 NEW)
|
||||
|
||||
enable_language(C)
|
||||
|
Loading…
Reference in New Issue
Block a user