Browse Source

CMP0029: Remove support for OLD subdir_depends command

Brad King 1 year ago
parent
commit
683a02f5a0

+ 4 - 3
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

+ 0 - 2
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

+ 3 - 4
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.");

+ 1 - 1
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.",   \

+ 0 - 11
Source/cmSubdirDependsCommand.cxx

@@ -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<std::string> const&,
-                            cmExecutionStatus&)
-{
-  return true;
-}

+ 0 - 13
Source/cmSubdirDependsCommand.h

@@ -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 <string>
-#include <vector>
-
-class cmExecutionStatus;
-
-bool cmSubdirDependsCommand(std::vector<std::string> const& args,
-                            cmExecutionStatus& status);

+ 0 - 2
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)

+ 0 - 2
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)

+ 2 - 2
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\)

+ 0 - 1
Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake

@@ -1,2 +1 @@
-cmake_policy(SET CMP0029 NEW)
 subdir_depends()

+ 0 - 10
Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt

@@ -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\)$

+ 0 - 2
Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake

@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0029 OLD)
-subdir_depends()

+ 0 - 7
Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt

@@ -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.

+ 0 - 1
Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake

@@ -1 +0,0 @@
-subdir_depends()

+ 1 - 1
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)

+ 7 - 1
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