diff --git a/Help/policy/CMP0059.rst b/Help/policy/CMP0059.rst index 4ac286d2f5..3dfc81b9ee 100644 --- a/Help/policy/CMP0059.rst +++ b/Help/policy/CMP0059.rst @@ -1,6 +1,9 @@ CMP0059 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + .. versionadded:: 3.3 Do not treat ``DEFINITIONS`` as a built-in directory property. @@ -14,7 +17,5 @@ so far to the :command:`add_definitions` command. The ``NEW`` behavior is to behave as a normal user-defined directory property. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3 -.. |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/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index d05f1c6268..122eb168c3 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -5,14 +5,10 @@ #include "cmExecutionStatus.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmMessageType.h" -#include "cmPolicies.h" #include "cmSystemTools.h" #include "cmValue.h" namespace { -void StoreResult(cmMakefile& makefile, std::string const& variable, - const char* prop); void StoreResult(cmMakefile& makefile, std::string const& variable, cmValue prop); } @@ -78,31 +74,11 @@ bool cmGetDirectoryPropertyCommand(std::vector const& args, return false; } - if (*i == "DEFINITIONS") { - switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0059)) { - case cmPolicies::WARN: - status.GetMakefile().IssueMessage( - MessageType::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(cmPolicies::CMP0059)); - CM_FALLTHROUGH; - case cmPolicies::OLD: - StoreResult(status.GetMakefile(), variable, - status.GetMakefile().GetDefineFlagsCMP0059()); - return true; - case cmPolicies::NEW: - break; - } - } StoreResult(status.GetMakefile(), variable, dir->GetProperty(*i)); return true; } namespace { -void StoreResult(cmMakefile& makefile, std::string const& variable, - const char* prop) -{ - makefile.AddDefinition(variable, prop ? prop : ""); -} void StoreResult(cmMakefile& makefile, std::string const& variable, cmValue prop) { diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 96373494be..0a0df88ce3 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -12,7 +12,6 @@ #include "cmGlobalGenerator.h" #include "cmInstalledFile.h" #include "cmMakefile.h" -#include "cmMessageType.h" #include "cmPolicies.h" #include "cmProperty.h" #include "cmPropertyDefinition.h" @@ -370,20 +369,6 @@ bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name, } } - if (propertyName == "DEFINITIONS") { - switch (mf->GetPolicyStatus(cmPolicies::CMP0059)) { - case cmPolicies::WARN: - mf->IssueMessage(MessageType::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(cmPolicies::CMP0059)); - CM_FALLTHROUGH; - case cmPolicies::OLD: - return StoreResult(infoType, status.GetMakefile(), variable, - mf->GetDefineFlagsCMP0059()); - case cmPolicies::NEW: - break; - } - } - // Get the property. return StoreResult(infoType, status.GetMakefile(), variable, mf->GetProperty(propertyName)); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8e16f17f9d..630777933f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1245,9 +1245,6 @@ void cmMakefile::AddDefineFlag(std::string const& flag) return; } - // Update the string used for the old DEFINITIONS property. - s_AddDefineFlag(flag, this->DefineFlagsOrig); - // If this is really a definition, update COMPILE_DEFINITIONS. if (this->ParseDefineFlag(flag, false)) { return; @@ -1281,9 +1278,6 @@ void cmMakefile::RemoveDefineFlag(std::string const& flag) return; } - // Update the string used for the old DEFINITIONS property. - s_RemoveDefineFlag(flag, this->DefineFlagsOrig); - // If this is really a definition, update COMPILE_DEFINITIONS. if (this->ParseDefineFlag(flag, true)) { return; @@ -1357,7 +1351,6 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) // define flags this->DefineFlags = parent->DefineFlags; - this->DefineFlagsOrig = parent->DefineFlagsOrig; // Include transform property. There is no per-config version. { @@ -3977,11 +3970,6 @@ cmStateSnapshot cmMakefile::GetStateSnapshot() const return this->StateSnapshot; } -const char* cmMakefile::GetDefineFlagsCMP0059() const -{ - return this->DefineFlagsOrig.c_str(); -} - cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id, bool parent_scope) const { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 199995b9cd..74f988e8a1 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -1006,8 +1006,6 @@ public: cmStateSnapshot GetStateSnapshot() const; - const char* GetDefineFlagsCMP0059() const; - void EnforceDirectoryLevelRules() const; void AddEvaluationFile( @@ -1134,9 +1132,6 @@ protected: std::string ComplainFileRegularExpression; std::string DefineFlags; - // Track the value of the computed DEFINITIONS property. - std::string DefineFlagsOrig; - #if !defined(CMAKE_BOOTSTRAP) std::vector SourceGroups; size_t ObjectLibrariesSourceGroupIndex; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 03b6f81c75..041d67c17a 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -174,7 +174,7 @@ class cmMakefile; NEW) \ SELECT(POLICY, CMP0059, \ "Do not treat DEFINITIONS as a built-in directory property.", 3, 3, \ - 0, WARN) \ + 0, NEW) \ SELECT(POLICY, CMP0060, \ "Link libraries by full path even in implicit directories.", 3, 3, \ 0, WARN) \ diff --git a/Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt b/Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake b/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake index f7b9303cd4..0dde53692c 100644 --- a/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake +++ b/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake @@ -1,6 +1,3 @@ - -cmake_policy(SET CMP0059 NEW) - add_definitions(-DSOME_DEF) get_property(defs DIRECTORY . diff --git a/Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt b/Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt b/Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt deleted file mode 100644 index e35e8c5f1b..0000000000 --- a/Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -DEFS: -DSOME_DEF -CUSTOM CONTENT: -DSOME_DEF diff --git a/Tests/RunCMake/CMP0059/CMP0059-OLD.cmake b/Tests/RunCMake/CMP0059/CMP0059-OLD.cmake deleted file mode 100644 index 25557744d4..0000000000 --- a/Tests/RunCMake/CMP0059/CMP0059-OLD.cmake +++ /dev/null @@ -1,17 +0,0 @@ - -cmake_policy(SET CMP0059 OLD) - -add_definitions(-DSOME_DEF) - -get_property(defs DIRECTORY . - PROPERTY DEFINITIONS -) -message("DEFS:${defs}") - -set_property(DIRECTORY . - PROPERTY DEFINITIONS CUSTOM_CONTENT -) -get_property(content DIRECTORY . - PROPERTY DEFINITIONS -) -message("CUSTOM CONTENT:${content}") diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt b/Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt b/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt deleted file mode 100644 index 06c7be3120..0000000000 --- a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt +++ /dev/null @@ -1,18 +0,0 @@ -CMake Warning \(dev\) at CMP0059-WARN.cmake:6 \(get_property\): - Policy CMP0059 is not set: Do not treat DEFINITIONS as a built-in directory - property. Run "cmake --help-policy CMP0059" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -DEFS: -DSOME_DEF -CMake Warning \(dev\) at CMP0059-WARN.cmake:14 \(get_property\): - Policy CMP0059 is not set: Do not treat DEFINITIONS as a built-in directory - property. Run "cmake --help-policy CMP0059" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CUSTOM CONTENT: -DSOME_DEF diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN.cmake b/Tests/RunCMake/CMP0059/CMP0059-WARN.cmake deleted file mode 100644 index 9d0b49c8e2..0000000000 --- a/Tests/RunCMake/CMP0059/CMP0059-WARN.cmake +++ /dev/null @@ -1,17 +0,0 @@ - - - -add_definitions(-DSOME_DEF) - -get_property(defs DIRECTORY . - PROPERTY DEFINITIONS -) -message("DEFS:${defs}") - -set_property(DIRECTORY . - PROPERTY DEFINITIONS CUSTOM_CONTENT -) -get_property(content DIRECTORY . - PROPERTY DEFINITIONS -) -message("CUSTOM CONTENT:${content}") diff --git a/Tests/RunCMake/CMP0059/CMakeLists.txt b/Tests/RunCMake/CMP0059/CMakeLists.txt index ef2163c298..bf2ef1506e 100644 --- a/Tests/RunCMake/CMP0059/CMakeLists.txt +++ b/Tests/RunCMake/CMP0059/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0059/RunCMakeTest.cmake b/Tests/RunCMake/CMP0059/RunCMakeTest.cmake index 9b5757954c..b95bb0f943 100644 --- a/Tests/RunCMake/CMP0059/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0059/RunCMakeTest.cmake @@ -1,5 +1,3 @@ include(RunCMake) -run_cmake(CMP0059-OLD) run_cmake(CMP0059-NEW) -run_cmake(CMP0059-WARN)