diff --git a/Help/policy/CMP0021.rst b/Help/policy/CMP0021.rst index 2c49c33cb1..b9074ab156 100644 --- a/Help/policy/CMP0021.rst +++ b/Help/policy/CMP0021.rst @@ -1,6 +1,9 @@ CMP0021 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + Fatal error on relative paths in :prop_tgt:`INCLUDE_DIRECTORIES` target property. @@ -15,7 +18,5 @@ policy is to issue a ``FATAL_ERROR`` if ``INCLUDE_DIRECTORIES`` contains a relative path. .. |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 diff --git a/Source/cmGeneratorTarget_IncludeDirectories.cxx b/Source/cmGeneratorTarget_IncludeDirectories.cxx index fc89331bef..cc6ec0cecd 100644 --- a/Source/cmGeneratorTarget_IncludeDirectories.cxx +++ b/Source/cmGeneratorTarget_IncludeDirectories.cxx @@ -185,7 +185,6 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt, if (!cmSystemTools::FileIsFullPath(entryInclude)) { std::ostringstream e; - bool noMessage = false; MessageType messageType = MessageType::FATAL_ERROR; if (!targetName.empty()) { /* clang-format off */ @@ -194,27 +193,13 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt, " \"" << entryInclude << "\""; /* clang-format on */ } else { - switch (tgt->GetPolicyStatusCMP0021()) { - case cmPolicies::WARN: { - e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0021) << "\n"; - messageType = MessageType::AUTHOR_WARNING; - } break; - case cmPolicies::OLD: - noMessage = true; - break; - case cmPolicies::NEW: - // Issue the fatal message. - break; - } e << "Found relative path while evaluating include directories of " "\"" << tgt->GetName() << "\":\n \"" << entryInclude << "\"\n"; } - if (!noMessage) { - tgt->GetLocalGenerator()->IssueMessage(messageType, e.str()); - if (messageType == MessageType::FATAL_ERROR) { - return; - } + tgt->GetLocalGenerator()->IssueMessage(messageType, e.str()); + if (messageType == MessageType::FATAL_ERROR) { + return; } } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 55c977e301..51e9333576 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -76,7 +76,7 @@ class cmMakefile; SELECT( \ POLICY, CMP0021, \ "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \ - 2, 8, 12, WARN) \ + 2, 8, 12, NEW) \ SELECT(POLICY, CMP0022, \ "INTERFACE_LINK_LIBRARIES defines the link interface.", 2, 8, 12, \ WARN) \ diff --git a/Tests/IncludeDirectories/CMP0021/CMakeLists.txt b/Tests/IncludeDirectories/CMP0021/CMakeLists.txt deleted file mode 100644 index 0b9aee899a..0000000000 --- a/Tests/IncludeDirectories/CMP0021/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ - -cmake_policy(SET CMP0021 OLD) -add_executable(cmp0021exe main.cpp) - -if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/includes") - execute_process(COMMAND ${CMAKE_COMMAND} -E - copy_directory - "${CMAKE_CURRENT_SOURCE_DIR}/includes" - "${CMAKE_CURRENT_BINARY_DIR}/includes" - ) -endif() -set_property(TARGET cmp0021exe PROPERTY - INCLUDE_DIRECTORIES includes/cmp0021) diff --git a/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h b/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h deleted file mode 100644 index 3d49b31d57..0000000000 --- a/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h +++ /dev/null @@ -1,2 +0,0 @@ - -#define CMP0021_DEFINE diff --git a/Tests/IncludeDirectories/CMP0021/main.cpp b/Tests/IncludeDirectories/CMP0021/main.cpp deleted file mode 100644 index 0f87dd9970..0000000000 --- a/Tests/IncludeDirectories/CMP0021/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "cmp0021.h" - -#ifndef CMP0021_DEFINE -# error Expected CMP0021_DEFINE -#endif - -int main(int, char**) -{ - return 0; -} diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index e9c1c63637..854a42a103 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -206,7 +206,3 @@ get_target_property(incs empty_entry_test INCLUDE_DIRECTORIES) if (NOT incs STREQUAL ";/one/two") message(SEND_ERROR "Empty include_directories entry was not ignored.") endif() - -if(NOT CMAKE_GENERATOR STREQUAL "Xcode" AND NOT CMAKE_GENERATOR MATCHES "Ninja") - add_subdirectory(CMP0021) -endif() diff --git a/Tests/RunCMake/include_directories/CMP0021.cmake b/Tests/RunCMake/include_directories/CMP0021.cmake index f18666b076..63b1930e17 100644 --- a/Tests/RunCMake/include_directories/CMP0021.cmake +++ b/Tests/RunCMake/include_directories/CMP0021.cmake @@ -1,7 +1,5 @@ enable_language(CXX) -cmake_policy(SET CMP0021 NEW) - add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>")