diff --git a/Help/command/subdir_depends.rst b/Help/command/subdir_depends.rst index c72a4afcf..5676c8f40 100644 --- a/Help/command/subdir_depends.rst +++ b/Help/command/subdir_depends.rst @@ -1,7 +1,9 @@ subdir_depends -------------- -Deprecated. Does nothing. +Disallowed. See CMake Policy :policy:`CMP0029`. + +Does nothing. :: diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index cb328eef8..d58fabc4c 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -58,3 +58,4 @@ All Policies /policy/CMP0026 /policy/CMP0027 /policy/CMP0028 + /policy/CMP0029 diff --git a/Help/policy/CMP0029.rst b/Help/policy/CMP0029.rst new file mode 100644 index 000000000..92ef1ec41 --- /dev/null +++ b/Help/policy/CMP0029.rst @@ -0,0 +1,10 @@ +CMP0029 +------- + +The :command:`subdir_depends` command should not be called. + +The implementation of this command has been empty since December 2001 +but was kept in CMake for compatibility for a long time. + +.. |disallowed_version| replace:: 3.0.0 +.. include:: DISALLOWED_COMMAND.txt diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f7efc1e44..fcc5bfc75 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -246,6 +246,11 @@ cmPolicies::cmPolicies() CMP0028, "CMP0028", "Double colon in target name means ALIAS or IMPORTED target.", 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0029, "CMP0029", + "The subdir_depends command should not be called.", + 3,0,0,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 68cd7c227..343c01d78 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -80,6 +80,7 @@ public: CMP0027, ///< Conditionally linked imported targets with missing include /// directories. CMP0028, ///< Double colon in target name means ALIAS or IMPORTED target. + CMP0029, ///< Disallow command: subdir_depends /** \brief Always the last entry. * diff --git a/Source/cmSubdirDependsCommand.cxx b/Source/cmSubdirDependsCommand.cxx index 2af7bf1c9..938198300 100644 --- a/Source/cmSubdirDependsCommand.cxx +++ b/Source/cmSubdirDependsCommand.cxx @@ -11,10 +11,10 @@ ============================================================================*/ #include "cmSubdirDependsCommand.h" -// cmSubdirDependsCommand bool cmSubdirDependsCommand::InitialPass(std::vector const& , cmExecutionStatus &) { + this->Disallowed(cmPolicies::CMP0029, + "The subdir_depends command should not be called; see CMP0029."); return true; } - diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index e6f1f8fc1..f78cfb701 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.h @@ -14,45 +14,15 @@ #include "cmCommand.h" -/** \class cmSubdirDependsCommand - * \brief Legacy command. Do not use. - * - * cmSubdirDependsCommand has been left in CMake for compatability with - * projects already using it. Its functionality in supporting parallel - * builds is now automatic. The command does not do anything. - */ class cmSubdirDependsCommand : public cmCommand { public: - /** - * This is a virtual constructor for the command. - */ - virtual cmCommand* Clone() - { - return new cmSubdirDependsCommand; - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ + virtual cmCommand* Clone() { return new cmSubdirDependsCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - - /** - * The name of the command as specified in CMakeList.txt. - */ virtual const char* GetName() const { return "subdir_depends";} - - /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() const - { - return true; - } - + virtual bool IsDiscouraged() const { return true; } cmTypeMacro(cmSubdirDependsCommand, cmCommand); }; - - #endif diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt new file mode 100644 index 000000000..e14708112 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0029-NEW.cmake:2 \(subdir_depends\): + The subdir_depends command should not be called; see CMP0029. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake new file mode 100644 index 000000000..392b9d409 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0029 NEW) +subdir_depends() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt new file mode 100644 index 000000000..10f32932e --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake new file mode 100644 index 000000000..099fd90d3 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0029 OLD) +subdir_depends() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt new file mode 100644 index 000000000..32a452a74 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at CMP0029-WARN.cmake:1 \(subdir_depends\): + Policy CMP0029 is not set: The subdir_depends command should not be called. + Run "cmake --help-policy CMP0029" 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. diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake new file mode 100644 index 000000000..1ceb1f85e --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake @@ -0,0 +1 @@ +subdir_depends() diff --git a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake index 5f26857c5..50911ac7c 100644 --- a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake +++ b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) foreach(p + CMP0029 ) run_cmake(${p}-WARN) run_cmake(${p}-OLD)