From 2e469212c89c8a7569cc21e271298040d8a2190c Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 27 Feb 2023 14:13:21 -0500 Subject: Dart,FindDart: Add policy to remove these modules These modules and the "DART" tool they support have long been replaced by CTest. --- Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0145.rst | 30 ++++++++++++++++++++++ Help/release/dev/remove-dart-modules.rst | 5 ++++ Modules/Dart.cmake | 19 ++++++++++++++ Modules/FindDart.cmake | 8 ++++++ Source/cmFindPackageCommand.cxx | 1 + Source/cmIncludeCommand.cxx | 2 ++ Source/cmPolicies.h | 4 ++- Tests/RunCMake/CTest/CMP0145-Dart-NEW-result.txt | 1 + Tests/RunCMake/CTest/CMP0145-Dart-NEW-stderr.txt | 6 +++++ Tests/RunCMake/CTest/CMP0145-Dart-NEW.cmake | 2 ++ Tests/RunCMake/CTest/CMP0145-Dart-OLD.cmake | 7 +++++ Tests/RunCMake/CTest/CMP0145-Dart-WARN-stderr.txt | 18 +++++++++++++ Tests/RunCMake/CTest/CMP0145-Dart-WARN.cmake | 7 +++++ .../RunCMake/CTest/CMP0145-FindDart-NEW-result.txt | 1 + .../RunCMake/CTest/CMP0145-FindDart-NEW-stderr.txt | 6 +++++ Tests/RunCMake/CTest/CMP0145-FindDart-NEW.cmake | 2 ++ Tests/RunCMake/CTest/CMP0145-FindDart-OLD.cmake | 7 +++++ .../CTest/CMP0145-FindDart-WARN-stderr.txt | 8 ++++++ Tests/RunCMake/CTest/CMP0145-FindDart-WARN.cmake | 7 +++++ Tests/RunCMake/CTest/RunCMakeTest.cmake | 7 +++++ Tests/RunCMake/find_package/CMP0145-NEW-stderr.txt | 4 +++ Tests/RunCMake/find_package/CMP0145-NEW.cmake | 7 +++++ Tests/RunCMake/find_package/CMP0145-OLD.cmake | 7 +++++ .../RunCMake/find_package/CMP0145-WARN-stderr.txt | 8 ++++++ Tests/RunCMake/find_package/CMP0145-WARN.cmake | 6 +++++ Tests/RunCMake/find_package/RunCMakeTest.cmake | 3 +++ 27 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 Help/policy/CMP0145.rst create mode 100644 Help/release/dev/remove-dart-modules.rst create mode 100644 Tests/RunCMake/CTest/CMP0145-Dart-NEW-result.txt create mode 100644 Tests/RunCMake/CTest/CMP0145-Dart-NEW-stderr.txt create mode 100644 Tests/RunCMake/CTest/CMP0145-Dart-NEW.cmake create mode 100644 Tests/RunCMake/CTest/CMP0145-Dart-OLD.cmake create mode 100644 Tests/RunCMake/CTest/CMP0145-Dart-WARN-stderr.txt create mode 100644 Tests/RunCMake/CTest/CMP0145-Dart-WARN.cmake create mode 100644 Tests/RunCMake/CTest/CMP0145-FindDart-NEW-result.txt create mode 100644 Tests/RunCMake/CTest/CMP0145-FindDart-NEW-stderr.txt create mode 100644 Tests/RunCMake/CTest/CMP0145-FindDart-NEW.cmake create mode 100644 Tests/RunCMake/CTest/CMP0145-FindDart-OLD.cmake create mode 100644 Tests/RunCMake/CTest/CMP0145-FindDart-WARN-stderr.txt create mode 100644 Tests/RunCMake/CTest/CMP0145-FindDart-WARN.cmake create mode 100644 Tests/RunCMake/find_package/CMP0145-NEW-stderr.txt create mode 100644 Tests/RunCMake/find_package/CMP0145-NEW.cmake create mode 100644 Tests/RunCMake/find_package/CMP0145-OLD.cmake create mode 100644 Tests/RunCMake/find_package/CMP0145-WARN-stderr.txt create mode 100644 Tests/RunCMake/find_package/CMP0145-WARN.cmake diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index e4c286d..28272ad 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.27 .. toctree:: :maxdepth: 1 + CMP0145: The Dart and FindDart modules are removed. CMP0144: find_package uses upper-case PACKAGENAME_ROOT variables. Policies Introduced by CMake 3.26 diff --git a/Help/policy/CMP0145.rst b/Help/policy/CMP0145.rst new file mode 100644 index 0000000..bb1c02e --- /dev/null +++ b/Help/policy/CMP0145.rst @@ -0,0 +1,30 @@ +CMP0145 +------- + +.. versionadded:: 3.27 + +The :module:`Dart` and :module:`FindDart` modules are removed. + +These modules were added very early in CMake's development to support +driving tests with a "DART" tool, but DART has not been distributed or +maintained for many years. Projects would ``include(Dart)`` to use it, +and the ``Dart`` module would run ``find_package(Dart)`` internally. +Since :manual:`ctest(1)` was created, the ``Dart`` module has just been +a compatibility shim that finds ``Dart`` to support some legacy +functionality and then forwards to the :module:`CTest` module. + +CMake 3.27 and above prefer to not provide the :module:`Dart` or +:module:`FindDart` modules. This policy provides compatibility for +projects that have not been ported away from them. Projects using the +``Dart`` module should be updated to use the :module:`CTest` module directly. + +The ``OLD`` behavior of this policy is for ``include(Dart)`` and +``find_package(Dart)`` to load the deprecated modules. The ``NEW`` +behavior is for uses of the modules to fail as if they do not exist. + +This policy was introduced in CMake version 3.27. CMake version +|release| warns when the policy is not set and uses ``OLD`` behavior. +Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` +explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/remove-dart-modules.rst b/Help/release/dev/remove-dart-modules.rst new file mode 100644 index 0000000..5da2eda --- /dev/null +++ b/Help/release/dev/remove-dart-modules.rst @@ -0,0 +1,5 @@ +remove-dart-modules +------------------- + +* The :module:`Dart` and :module:`FindDart` modules have been deprecated via + policy :policy:`CMP0145`. Port projects to the :module:`CTest` module. diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake index 154fe9d..3610012 100644 --- a/Modules/Dart.cmake +++ b/Modules/Dart.cmake @@ -5,6 +5,11 @@ Dart ---- +.. deprecated:: 3.27 + This module is available only if policy :policy:`CMP0145` + is not set to ``NEW``. Do not use it in new code. + Use the :module:`CTest` module instead. + Configure a project for testing with CTest or old Dart Tcl Client This file is the backwards-compatibility version of the CTest module. @@ -33,10 +38,24 @@ whether testing support should be enabled. The default is ON. # # +# include(Dart) already warns about CMP0145, but back when this module was in +# common use, it was often loaded via include(${CMAKE_ROOT}/Modules/Dart.cmake) +# which will not warn. Warn again just in case. +cmake_policy(GET CMP0145 cmp0145) +if(cmp0145 STREQUAL "") + cmake_policy(GET_WARNING CMP0145 _cmp0145_warning) + message(AUTHOR_WARNING "${_cmp0145_warning}") +endif() + option(BUILD_TESTING "Build the testing tree." ON) if(BUILD_TESTING) + # We only get here if a project already ran include(Dart), + # so avoid warning about CMP0145 again. + cmake_policy(PUSH) + cmake_policy(SET CMP0145 OLD) find_package(Dart QUIET) + cmake_policy(POP) # # Section #1: diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake index 0492578..fed50e1 100644 --- a/Modules/FindDart.cmake +++ b/Modules/FindDart.cmake @@ -5,12 +5,20 @@ FindDart -------- +.. deprecated:: 3.27 + This module is available only if policy :policy:`CMP0145` is not set to ``NEW``. + Find DART This module looks for the dart testing software and sets DART_ROOT to point to where it found it. #]=======================================================================] +if(_FindDart_testing) + set(_FindDart_included TRUE) + return() +endif() + find_path(DART_ROOT README.INSTALL HINTS ENV DART_ROOT diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 5f1a2c5..8acfe83 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -502,6 +502,7 @@ cmFindPackageCommand::cmFindPackageCommand(cmExecutionStatus& status) this->DebugMode = false; this->AppendSearchPathGroups(); + this->DeprecatedFindModules["Dart"] = cmPolicies::CMP0145; this->DeprecatedFindModules["Qt"] = cmPolicies::CMP0084; } diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 9242344..3564cf7 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -20,7 +20,9 @@ bool cmIncludeCommand(std::vector const& args, { static std::map DeprecatedModules; if (DeprecatedModules.empty()) { + DeprecatedModules["Dart"] = cmPolicies::CMP0145; DeprecatedModules["Documentation"] = cmPolicies::CMP0106; + DeprecatedModules["FindDart"] = cmPolicies::CMP0145; DeprecatedModules["WriteCompilerDetectionHeader"] = cmPolicies::CMP0120; } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 1eca586..830e14b 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -437,7 +437,9 @@ class cmMakefile; cmPolicies::WARN) \ SELECT(POLICY, CMP0144, \ "find_package uses upper-case _ROOT variables.", 3, 27, \ - 0, cmPolicies::WARN) + 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0145, "The Dart and FindDart modules are removed.", 3, \ + 27, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Tests/RunCMake/CTest/CMP0145-Dart-NEW-result.txt b/Tests/RunCMake/CTest/CMP0145-Dart-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-Dart-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTest/CMP0145-Dart-NEW-stderr.txt b/Tests/RunCMake/CTest/CMP0145-Dart-NEW-stderr.txt new file mode 100644 index 0000000..06fce77 --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-Dart-NEW-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMP0145-Dart-NEW\.cmake:[0-9]+ \(include\): + include could not find requested file: + + Dart +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CTest/CMP0145-Dart-NEW.cmake b/Tests/RunCMake/CTest/CMP0145-Dart-NEW.cmake new file mode 100644 index 0000000..5b14ecc --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-Dart-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0145 NEW) +include(Dart) diff --git a/Tests/RunCMake/CTest/CMP0145-Dart-OLD.cmake b/Tests/RunCMake/CTest/CMP0145-Dart-OLD.cmake new file mode 100644 index 0000000..2f66c3f --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-Dart-OLD.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0145 OLD) +set(_FindDart_testing 1) +include(Dart) + +if(NOT _FindDart_included) + message(FATAL_ERROR "FindDart.cmake not included") +endif() diff --git a/Tests/RunCMake/CTest/CMP0145-Dart-WARN-stderr.txt b/Tests/RunCMake/CTest/CMP0145-Dart-WARN-stderr.txt new file mode 100644 index 0000000..5a751fc --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-Dart-WARN-stderr.txt @@ -0,0 +1,18 @@ +^CMake Warning \(dev\) at CMP0145-Dart-WARN\.cmake:[0-9]+ \(include\): + Policy CMP0145 is not set: The Dart and FindDart modules are removed\. Run + "cmake --help-policy CMP0145" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning \(dev\) at [^ +]*/Modules/Dart\.cmake:[0-9]+ \(message\): + Policy CMP0145 is not set: The Dart and FindDart modules are removed\. Run + "cmake --help-policy CMP0145" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. +Call Stack \(most recent call first\): + CMP0145-Dart-WARN\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/CTest/CMP0145-Dart-WARN.cmake b/Tests/RunCMake/CTest/CMP0145-Dart-WARN.cmake new file mode 100644 index 0000000..1398dbe --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-Dart-WARN.cmake @@ -0,0 +1,7 @@ +# Do not set CMP0145. +set(_FindDart_testing 1) +include(Dart) + +if(NOT _FindDart_included) + message(FATAL_ERROR "FindDart.cmake not included") +endif() diff --git a/Tests/RunCMake/CTest/CMP0145-FindDart-NEW-result.txt b/Tests/RunCMake/CTest/CMP0145-FindDart-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-FindDart-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTest/CMP0145-FindDart-NEW-stderr.txt b/Tests/RunCMake/CTest/CMP0145-FindDart-NEW-stderr.txt new file mode 100644 index 0000000..b045636 --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-FindDart-NEW-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMP0145-FindDart-NEW\.cmake:[0-9]+ \(include\): + include could not find requested file: + + FindDart +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CTest/CMP0145-FindDart-NEW.cmake b/Tests/RunCMake/CTest/CMP0145-FindDart-NEW.cmake new file mode 100644 index 0000000..c1227d6 --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-FindDart-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0145 NEW) +include(FindDart) diff --git a/Tests/RunCMake/CTest/CMP0145-FindDart-OLD.cmake b/Tests/RunCMake/CTest/CMP0145-FindDart-OLD.cmake new file mode 100644 index 0000000..b9f3c76 --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-FindDart-OLD.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0145 OLD) +set(_FindDart_testing 1) +include(FindDart) + +if(NOT _FindDart_included) + message(FATAL_ERROR "FindDart.cmake not included") +endif() diff --git a/Tests/RunCMake/CTest/CMP0145-FindDart-WARN-stderr.txt b/Tests/RunCMake/CTest/CMP0145-FindDart-WARN-stderr.txt new file mode 100644 index 0000000..d076235 --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-FindDart-WARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at CMP0145-FindDart-WARN\.cmake:[0-9]+ \(include\): + Policy CMP0145 is not set: The Dart and FindDart modules are removed\. Run + "cmake --help-policy CMP0145" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/CTest/CMP0145-FindDart-WARN.cmake b/Tests/RunCMake/CTest/CMP0145-FindDart-WARN.cmake new file mode 100644 index 0000000..59febdf --- /dev/null +++ b/Tests/RunCMake/CTest/CMP0145-FindDart-WARN.cmake @@ -0,0 +1,7 @@ +# Do not set CMP0145. +set(_FindDart_testing 1) +include(FindDart) + +if(NOT _FindDart_included) + message(FATAL_ERROR "FindDart.cmake not included") +endif() diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake index b81f319..4c2c107 100644 --- a/Tests/RunCMake/CTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake @@ -39,3 +39,10 @@ endfunction() if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) run_SingleConfig() endif() + +run_cmake(CMP0145-Dart-OLD) +run_cmake(CMP0145-Dart-WARN) +run_cmake(CMP0145-Dart-NEW) +run_cmake(CMP0145-FindDart-OLD) +run_cmake(CMP0145-FindDart-WARN) +run_cmake(CMP0145-FindDart-NEW) diff --git a/Tests/RunCMake/find_package/CMP0145-NEW-stderr.txt b/Tests/RunCMake/find_package/CMP0145-NEW-stderr.txt new file mode 100644 index 0000000..8249211 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0145-NEW-stderr.txt @@ -0,0 +1,4 @@ +^CMake Warning at CMP0145-NEW\.cmake:[0-9]+ \(find_package\): + No "FindDart\.cmake" found in CMAKE_MODULE_PATH\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/find_package/CMP0145-NEW.cmake b/Tests/RunCMake/find_package/CMP0145-NEW.cmake new file mode 100644 index 0000000..f3e7bef --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0145-NEW.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0145 NEW) +set(_FindDart_testing TRUE) +find_package(Dart MODULE) + +if(_FindDart_included) + message(FATAL_ERROR "FindDart.cmake erroneously included") +endif() diff --git a/Tests/RunCMake/find_package/CMP0145-OLD.cmake b/Tests/RunCMake/find_package/CMP0145-OLD.cmake new file mode 100644 index 0000000..9a73f68 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0145-OLD.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0145 OLD) +set(_FindDart_testing TRUE) +find_package(Dart MODULE) + +if(NOT _FindDart_included) + message(FATAL_ERROR "FindDart.cmake not included") +endif() diff --git a/Tests/RunCMake/find_package/CMP0145-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0145-WARN-stderr.txt new file mode 100644 index 0000000..36c66ec --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0145-WARN-stderr.txt @@ -0,0 +1,8 @@ +CMake Warning \(dev\) at CMP0145-WARN\.cmake:[0-9]+ \(find_package\): + Policy CMP0145 is not set: The Dart and FindDart modules are removed\. Run + "cmake --help-policy CMP0145" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/find_package/CMP0145-WARN.cmake b/Tests/RunCMake/find_package/CMP0145-WARN.cmake new file mode 100644 index 0000000..76da752 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0145-WARN.cmake @@ -0,0 +1,6 @@ +set(_FindDart_testing TRUE) +find_package(Dart MODULE) + +if(NOT _FindDart_included) + message(FATAL_ERROR "FindDart.cmake not included") +endif() diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index e7e3a0b..f0bb011 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -36,6 +36,9 @@ run_cmake(WrongVersionConfig) run_cmake(CMP0084-OLD) run_cmake(CMP0084-WARN) run_cmake(CMP0084-NEW) +run_cmake(CMP0145-OLD) +run_cmake(CMP0145-WARN) +run_cmake(CMP0145-NEW) run_cmake(WrongVersionRange) run_cmake(EmptyVersionRange) run_cmake(VersionRangeWithEXACT) -- cgit v0.12