mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-23 07:28:51 -06:00
CMP0004: Remove support for OLD behavior
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
CMP0004
|
||||
-------
|
||||
|
||||
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
|
||||
.. include:: REMOVED_PROLOGUE.txt
|
||||
|
||||
Libraries linked may not have leading or trailing whitespace.
|
||||
|
||||
CMake versions 2.4 and below silently removed leading and trailing
|
||||
@@ -20,7 +23,5 @@ target is created by an :command:`add_executable` or :command:`add_library`
|
||||
command.
|
||||
|
||||
.. |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
|
||||
|
||||
@@ -4744,27 +4744,11 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
|
||||
}
|
||||
if (lib != item) {
|
||||
cmake* cm = this->LocalGenerator->GetCMakeInstance();
|
||||
switch (this->GetPolicyStatusCMP0004()) {
|
||||
case cmPolicies::WARN: {
|
||||
std::ostringstream w;
|
||||
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0004) << "\n"
|
||||
<< "Target \"" << this->GetName() << "\" links to item \"" << item
|
||||
<< "\" which has leading or trailing whitespace.";
|
||||
cm->IssueMessage(MessageType::AUTHOR_WARNING, w.str(),
|
||||
this->GetBacktrace());
|
||||
}
|
||||
CM_FALLTHROUGH;
|
||||
case cmPolicies::OLD:
|
||||
break;
|
||||
case cmPolicies::NEW: {
|
||||
std::ostringstream e;
|
||||
e << "Target \"" << this->GetName() << "\" links to item \"" << item
|
||||
<< "\" which has leading or trailing whitespace. "
|
||||
<< "This is now an error according to policy CMP0004.";
|
||||
cm->IssueMessage(MessageType::FATAL_ERROR, e.str(),
|
||||
this->GetBacktrace());
|
||||
} break;
|
||||
}
|
||||
std::ostringstream e;
|
||||
e << "Target \"" << this->GetName() << "\" links to item \"" << item
|
||||
<< "\" which has leading or trailing whitespace. "
|
||||
<< "This is now an error according to policy CMP0004.";
|
||||
cm->IssueMessage(MessageType::FATAL_ERROR, e.str(), this->GetBacktrace());
|
||||
}
|
||||
return lib;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class cmMakefile;
|
||||
2, 6, 0, NEW) \
|
||||
SELECT(POLICY, CMP0004, \
|
||||
"Libraries linked may not have leading or trailing whitespace.", 2, \
|
||||
6, 0, WARN) \
|
||||
6, 0, NEW) \
|
||||
SELECT(POLICY, CMP0005, \
|
||||
"Preprocessor definition values are now escaped automatically.", 2, \
|
||||
6, 0, WARN) \
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
1
|
||||
@@ -1,2 +0,0 @@
|
||||
Target "bat" links to item " bar " which has leading or trailing
|
||||
whitespace. This is now an error according to policy CMP0004.
|
||||
@@ -1,18 +0,0 @@
|
||||
cmake_policy(SET CMP0004 OLD)
|
||||
|
||||
add_library(foo SHARED empty.cpp)
|
||||
add_library(bar SHARED empty.cpp)
|
||||
add_library(bing SHARED empty.cpp)
|
||||
add_library(bung SHARED empty.cpp)
|
||||
|
||||
cmake_policy(SET CMP0004 NEW)
|
||||
|
||||
add_library(bat SHARED empty.cpp)
|
||||
|
||||
target_link_libraries(foo "$<1: bar >")
|
||||
target_link_libraries(bing "$<$<NOT:$<TARGET_POLICY:CMP0004>>: bar >")
|
||||
target_link_libraries(bung "$<$<TARGET_POLICY:CMP0004>: bar >")
|
||||
|
||||
# The line below causes the error because the policy is NEW when bat
|
||||
# is created.
|
||||
target_link_libraries(bat "$<1: bar >")
|
||||
@@ -1,5 +1,4 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(CMP0004-OLD)
|
||||
run_cmake(CMP0004-NEW)
|
||||
run_cmake(CMP0004-policy-genex)
|
||||
|
||||
Reference in New Issue
Block a user