diff --git a/Help/policy/CMP0004.rst b/Help/policy/CMP0004.rst index 74e3e6610c..d7ee3376a2 100644 --- a/Help/policy/CMP0004.rst +++ b/Help/policy/CMP0004.rst @@ -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 diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e2a0f2193c..c6457dd0c1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -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; } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index bdeaf36ae6..4c2127d957 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -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) \ diff --git a/Tests/RunCMake/CMP0004/CMP0004-OLD-result.txt b/Tests/RunCMake/CMP0004/CMP0004-OLD-result.txt deleted file mode 100644 index d00491fd7e..0000000000 --- a/Tests/RunCMake/CMP0004/CMP0004-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/CMP0004/CMP0004-OLD-stderr.txt b/Tests/RunCMake/CMP0004/CMP0004-OLD-stderr.txt deleted file mode 100644 index 782e45c577..0000000000 --- a/Tests/RunCMake/CMP0004/CMP0004-OLD-stderr.txt +++ /dev/null @@ -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. diff --git a/Tests/RunCMake/CMP0004/CMP0004-OLD.cmake b/Tests/RunCMake/CMP0004/CMP0004-OLD.cmake deleted file mode 100644 index 32c147424e..0000000000 --- a/Tests/RunCMake/CMP0004/CMP0004-OLD.cmake +++ /dev/null @@ -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 "$<$>: bar >") -target_link_libraries(bung "$<$: bar >") - -# The line below causes the error because the policy is NEW when bat -# is created. -target_link_libraries(bat "$<1: bar >") diff --git a/Tests/RunCMake/CMP0004/RunCMakeTest.cmake b/Tests/RunCMake/CMP0004/RunCMakeTest.cmake index 950d0edbd4..8e3079c84e 100644 --- a/Tests/RunCMake/CMP0004/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0004/RunCMakeTest.cmake @@ -1,5 +1,4 @@ include(RunCMake) -run_cmake(CMP0004-OLD) run_cmake(CMP0004-NEW) run_cmake(CMP0004-policy-genex)