From 683a02f5a0729fefb91be0ce500523245e539039 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 26 Nov 2024 13:41:58 -0500 Subject: [PATCH] CMP0029: Remove support for OLD subdir_depends command --- Help/policy/CMP0029.rst | 7 ++++--- Source/CMakeLists.txt | 2 -- Source/cmCommands.cxx | 7 +++---- Source/cmPolicies.h | 2 +- Source/cmSubdirDependsCommand.cxx | 11 ----------- Source/cmSubdirDependsCommand.h | 13 ------------- Tests/Complex/CMakeLists.txt | 2 -- Tests/ComplexOneConfig/CMakeLists.txt | 2 -- .../DisallowedCommands/CMP0029-NEW-stderr.txt | 4 ++-- Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake | 1 - .../DisallowedCommands/CMP0029-OLD-stderr.txt | 10 ---------- Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake | 2 -- .../DisallowedCommands/CMP0029-WARN-stderr.txt | 7 ------- .../RunCMake/DisallowedCommands/CMP0029-WARN.cmake | 1 - Tests/RunCMake/DisallowedCommands/CMakeLists.txt | 2 +- .../RunCMake/DisallowedCommands/RunCMakeTest.cmake | 8 +++++++- 16 files changed, 18 insertions(+), 63 deletions(-) delete mode 100644 Source/cmSubdirDependsCommand.cxx delete mode 100644 Source/cmSubdirDependsCommand.h delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake diff --git a/Help/policy/CMP0029.rst b/Help/policy/CMP0029.rst index aa10b97a93..b5cca1e345 100644 --- a/Help/policy/CMP0029.rst +++ b/Help/policy/CMP0029.rst @@ -1,12 +1,13 @@ CMP0029 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + 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 -.. include:: DISALLOWED_COMMAND.txt - -.. include:: DEPRECATED.txt +.. include:: REMOVED_COMMAND.txt diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 047105c2eb..64ce8b9e2c 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -730,8 +730,6 @@ add_library( cmSubcommandTable.h cmSubdirCommand.cxx cmSubdirCommand.h - cmSubdirDependsCommand.cxx - cmSubdirDependsCommand.h cmTargetCompileDefinitionsCommand.cxx cmTargetCompileDefinitionsCommand.h cmTargetCompileFeaturesCommand.cxx diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index ce690bd3b2..370ff3e807 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -111,7 +111,6 @@ # include "cmRemoveCommand.h" # include "cmRemoveDefinitionsCommand.h" # include "cmSourceGroupCommand.h" -# include "cmSubdirDependsCommand.h" # include "cmTargetLinkDirectoriesCommand.h" # include "cmUseMangledMesaCommand.h" # include "cmUtilitySourceCommand.h" @@ -315,9 +314,9 @@ void GetProjectCommands(cmState* state) state->AddDisallowedCommand( "output_required_files", cmOutputRequiredFilesCommand, cmPolicies::CMP0032, "The output_required_files command should not be called; see CMP0032."); - state->AddDisallowedCommand( - "subdir_depends", cmSubdirDependsCommand, cmPolicies::CMP0029, - "The subdir_depends command should not be called; see CMP0029."); + state->AddRemovedCommand( + "subdir_depends", + "The subdir_depends command has been removed; see CMP0029."); state->AddDisallowedCommand( "utility_source", cmUtilitySourceCommand, cmPolicies::CMP0034, "The utility_source command should not be called; see CMP0034."); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index b3f907e0ed..bdbde4c0fc 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -97,7 +97,7 @@ class cmMakefile; "Double colon in target name means ALIAS or IMPORTED target.", 3, 0, \ 0, NEW) \ SELECT(POLICY, CMP0029, "The subdir_depends command should not be called.", \ - 3, 0, 0, WARN) \ + 3, 0, 0, NEW) \ SELECT(POLICY, CMP0030, \ "The use_mangled_mesa command should not be called.", 3, 0, 0, WARN) \ SELECT(POLICY, CMP0031, "The load_command command should not be called.", \ diff --git a/Source/cmSubdirDependsCommand.cxx b/Source/cmSubdirDependsCommand.cxx deleted file mode 100644 index 496c60da75..0000000000 --- a/Source/cmSubdirDependsCommand.cxx +++ /dev/null @@ -1,11 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmSubdirDependsCommand.h" - -class cmExecutionStatus; - -bool cmSubdirDependsCommand(std::vector const&, - cmExecutionStatus&) -{ - return true; -} diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h deleted file mode 100644 index 133d702808..0000000000 --- a/Source/cmSubdirDependsCommand.h +++ /dev/null @@ -1,13 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include "cmConfigure.h" // IWYU pragma: keep - -#include -#include - -class cmExecutionStatus; - -bool cmSubdirDependsCommand(std::vector const& args, - cmExecutionStatus& status); diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index f3537ef66b..abcaee1780 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -22,7 +22,6 @@ message("message") # It is not recommended to set a policy to OLD, but this test # covers the OLD behavior of some policies. foreach(p - CMP0029 CMP0032 CMP0033 CMP0034 @@ -439,6 +438,5 @@ endif() # add_subdirectory(Library) add_subdirectory(Executable) -subdir_depends(Executable Library) export_library_dependencies(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake) include(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL) diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index d43cebbf8c..9f7b3726a9 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -15,7 +15,6 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG") # It is not recommended to set a policy to OLD, but this test # covers the OLD behavior of some policies. foreach(p - CMP0029 CMP0032 CMP0033 CMP0034 @@ -396,6 +395,5 @@ endif() # add_subdirectory(Library) add_subdirectory(Executable) -subdir_depends(Executable Library) export_library_dependencies(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake) include(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt index e147081127..52ec78db7c 100644 --- a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at CMP0029-NEW.cmake:2 \(subdir_depends\): - The subdir_depends command should not be called; see CMP0029. +CMake Error at CMP0029-NEW.cmake:1 \(subdir_depends\): + The subdir_depends command has been removed; 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 index 392b9d409d..1ceb1f85ea 100644 --- a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake @@ -1,2 +1 @@ -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 deleted file mode 100644 index 430c86527a..0000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -^CMake Deprecation Warning at CMP0029-OLD.cmake:[0-9]+ \(cmake_policy\): - The OLD behavior for policy CMP0029 will be removed from a future version - of CMake. - - The cmake-policies\(7\) manual explains that the OLD behaviors of all - policies are deprecated and that a policy should be set to OLD only under - specific short-term circumstances. Projects should be ported to the NEW - behavior and not rely on setting a policy to OLD. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake deleted file mode 100644 index 099fd90d36..0000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 32a452a742..0000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index 1ceb1f85ea..0000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake +++ /dev/null @@ -1 +0,0 @@ -subdir_depends() diff --git a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt index 927c9b4af3..bf2ef1506e 100644 --- a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt +++ b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) # old enough to not set CMP0029 through CMP0036 +cmake_minimum_required(VERSION 3.10) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake index f3974eacf4..df8c39d5ae 100644 --- a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake +++ b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake @@ -1,8 +1,14 @@ include(RunCMake) -set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON) foreach(p CMP0029 + ) + run_cmake(${p}-NEW) +endforeach() + +return() + +foreach(p CMP0030 CMP0031 CMP0032