diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 7c41dedb6e..7c46a2aa39 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -98,6 +98,7 @@ Policies Introduced by CMake 4.1 .. toctree:: :maxdepth: 1 + CMP0188: The FindGCCXML module is removed. CMP0187: Include source file without an extension after the same name with an extension. CMP0186: Regular expressions match ^ at most once in repeated searches. diff --git a/Help/policy/CMP0188.rst b/Help/policy/CMP0188.rst new file mode 100644 index 0000000000..6b4cb83ea7 --- /dev/null +++ b/Help/policy/CMP0188.rst @@ -0,0 +1,21 @@ +CMP0188 +------- + +.. versionadded:: 4.1 + +The :module:`FindGCCXML` module is removed. + +CMake 4.0 and below provide the :module:`FindGCCXML` module, but the GCC-XML +tool has long been superseded by CastXML. CMake 4.1 and above prefer to not +provide the :module:`FindGCCXML` module. This policy provides compatibility +for projects that have not been ported away from it. + +The ``OLD`` behavior of this policy is for ``find_package(GCCXML)`` to load +the deprecated module. The ``NEW`` behavior is for ``find_package(GCCXML)`` +to fail as if the module does not exist. + +.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.1 +.. |WARNS_OR_DOES_NOT_WARN| replace:: warns +.. include:: STANDARD_ADVICE.txt + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/remove-FindGCCXML.rst b/Help/release/dev/remove-FindGCCXML.rst new file mode 100644 index 0000000000..7f17b913ad --- /dev/null +++ b/Help/release/dev/remove-FindGCCXML.rst @@ -0,0 +1,5 @@ +remove-FindGCCXML +----------------- + +* The :module:`FindGCCXML` module has been deprecated via policy + :policy:`CMP0188`. Port projects to CastXML instead. diff --git a/Modules/FindGCCXML.cmake b/Modules/FindGCCXML.cmake index e6c7f2434d..4da19fe1aa 100644 --- a/Modules/FindGCCXML.cmake +++ b/Modules/FindGCCXML.cmake @@ -5,17 +5,28 @@ FindGCCXML ---------- +.. versionchanged:: 4.1 + This module is available only if policy :policy:`CMP0188` is not set to ``NEW``. + Port projects to search for CastXML by calling ``find_program`` directly. + Find the GCC-XML front-end executable. - - This module will define the following variables: -:: - - GCCXML - the GCC-XML front-end executable. +``GCCXML`` + The GCC-XML front-end executable. #]=======================================================================] +cmake_policy(GET CMP0188 _FindGCCXML_CMP0188) +if(_FindGCCXML_CMP0188 STREQUAL "NEW") + message(FATAL_ERROR "The FindGCCXML module has been removed by policy CMP0188.") +endif() + +if(_FindGCCXML_testing) + set(_FindGCCXML_included TRUE) + return() +endif() + find_program(GCCXML NAMES gccxml ../GCC_XML/gccxml diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 772048526f..2c51cf095b 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -532,6 +532,7 @@ cmFindPackageCommand::cmFindPackageCommand(cmExecutionStatus& status) this->DeprecatedFindModules["Boost"] = cmPolicies::CMP0167; this->DeprecatedFindModules["CUDA"] = cmPolicies::CMP0146; this->DeprecatedFindModules["Dart"] = cmPolicies::CMP0145; + this->DeprecatedFindModules["GCCXML"] = cmPolicies::CMP0188; this->DeprecatedFindModules["PythonInterp"] = cmPolicies::CMP0148; this->DeprecatedFindModules["PythonLibs"] = cmPolicies::CMP0148; this->DeprecatedFindModules["Qt"] = cmPolicies::CMP0084; diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index e54a8b7a1c..0e8fa7403c 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -25,6 +25,7 @@ bool cmIncludeCommand(std::vector const& args, DeprecatedModules["FindBoost"] = cmPolicies::CMP0167; DeprecatedModules["FindCUDA"] = cmPolicies::CMP0146; DeprecatedModules["FindDart"] = cmPolicies::CMP0145; + DeprecatedModules["FindGCCXML"] = cmPolicies::CMP0188; DeprecatedModules["FindPythonInterp"] = cmPolicies::CMP0148; DeprecatedModules["FindPythonLibs"] = cmPolicies::CMP0148; DeprecatedModules["WriteCompilerDetectionHeader"] = cmPolicies::CMP0120; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 785acc02a0..c2449755b3 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -562,7 +562,8 @@ class cmMakefile; SELECT(POLICY, CMP0187, \ "Include source file without an extension after the same name with " \ "an extension.", \ - 4, 1, 0, WARN) + 4, 1, 0, WARN) \ + SELECT(POLICY, CMP0188, "The FindGCCXML module is removed.", 4, 1, 0, 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/find_package/CMP0188-NEW-stderr.txt b/Tests/RunCMake/find_package/CMP0188-NEW-stderr.txt new file mode 100644 index 0000000000..bf6264774e --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0188-NEW-stderr.txt @@ -0,0 +1,4 @@ +^CMake Warning at CMP0188-NEW\.cmake:[0-9]+ \(find_package\): + No "FindGCCXML\.cmake" found in CMAKE_MODULE_PATH\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/find_package/CMP0188-NEW.cmake b/Tests/RunCMake/find_package/CMP0188-NEW.cmake new file mode 100644 index 0000000000..940169d2b0 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0188-NEW.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0188 NEW) +set(_FindGCCXML_testing TRUE) +find_package(GCCXML MODULE) + +if(_FindGCCXML_included) + message(FATAL_ERROR "FindGCCXML.cmake erroneously included") +endif() diff --git a/Tests/RunCMake/find_package/CMP0188-OLD.cmake b/Tests/RunCMake/find_package/CMP0188-OLD.cmake new file mode 100644 index 0000000000..dc48c43ad1 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0188-OLD.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0188 OLD) +set(_FindGCCXML_testing TRUE) +find_package(GCCXML MODULE) + +if(NOT _FindGCCXML_included) + message(FATAL_ERROR "FindGCCXML.cmake not included") +endif() diff --git a/Tests/RunCMake/find_package/CMP0188-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0188-WARN-stderr.txt new file mode 100644 index 0000000000..de3b9f8737 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0188-WARN-stderr.txt @@ -0,0 +1,8 @@ +CMake Warning \(dev\) at CMP0188-WARN\.cmake:[0-9]+ \(find_package\): + Policy CMP0188 is not set: The FindGCCXML module is removed\. Run "cmake + --help-policy CMP0188" 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/CMP0188-WARN.cmake b/Tests/RunCMake/find_package/CMP0188-WARN.cmake new file mode 100644 index 0000000000..5931da5328 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0188-WARN.cmake @@ -0,0 +1,6 @@ +set(_FindGCCXML_testing TRUE) +find_package(GCCXML MODULE) + +if(NOT _FindGCCXML_included) + message(FATAL_ERROR "FindGCCXML.cmake not included") +endif() diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index 0552535e61..76a0d105f9 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -57,6 +57,9 @@ run_cmake(CMP0148-Libs-NEW) run_cmake(CMP0167-OLD) run_cmake(CMP0167-WARN) run_cmake(CMP0167-NEW) +run_cmake(CMP0188-OLD) +run_cmake(CMP0188-WARN) +run_cmake(CMP0188-NEW) run_cmake(WrongVersionRange) run_cmake(EmptyVersionRange) run_cmake(VersionRangeWithEXACT) diff --git a/Tests/RunCMake/include/CMP0188-NEW-name-result.txt b/Tests/RunCMake/include/CMP0188-NEW-name-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/include/CMP0188-NEW-name-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include/CMP0188-NEW-name-stderr.txt b/Tests/RunCMake/include/CMP0188-NEW-name-stderr.txt new file mode 100644 index 0000000000..0a86d22d82 --- /dev/null +++ b/Tests/RunCMake/include/CMP0188-NEW-name-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMP0188-NEW-name\.cmake:[0-9]+ \(include\): + include could not find requested file: + + FindGCCXML +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/include/CMP0188-NEW-name.cmake b/Tests/RunCMake/include/CMP0188-NEW-name.cmake new file mode 100644 index 0000000000..3cce95c3b5 --- /dev/null +++ b/Tests/RunCMake/include/CMP0188-NEW-name.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0188 NEW) +include(FindGCCXML) diff --git a/Tests/RunCMake/include/CMP0188-NEW-path-result.txt b/Tests/RunCMake/include/CMP0188-NEW-path-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/include/CMP0188-NEW-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include/CMP0188-NEW-path-stderr.txt b/Tests/RunCMake/include/CMP0188-NEW-path-stderr.txt new file mode 100644 index 0000000000..f030d7c787 --- /dev/null +++ b/Tests/RunCMake/include/CMP0188-NEW-path-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/Modules/FindGCCXML.cmake:[0-9]+ \(message\): + The FindGCCXML module has been removed by policy CMP0188\. +Call Stack \(most recent call first\): + CMP0188-NEW-path\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/include/CMP0188-NEW-path.cmake b/Tests/RunCMake/include/CMP0188-NEW-path.cmake new file mode 100644 index 0000000000..efc195ab4f --- /dev/null +++ b/Tests/RunCMake/include/CMP0188-NEW-path.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0188 NEW) +include(${CMAKE_ROOT}/Modules/FindGCCXML.cmake) diff --git a/Tests/RunCMake/include/CMP0188-OLD.cmake b/Tests/RunCMake/include/CMP0188-OLD.cmake new file mode 100644 index 0000000000..34d5ad4a2e --- /dev/null +++ b/Tests/RunCMake/include/CMP0188-OLD.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0188 OLD) +set(_FindGCCXML_testing 1) +include(FindGCCXML) + +if(NOT _FindGCCXML_included) + message(FATAL_ERROR "FindGCCXML.cmake not included") +endif() diff --git a/Tests/RunCMake/include/CMP0188-WARN-stderr.txt b/Tests/RunCMake/include/CMP0188-WARN-stderr.txt new file mode 100644 index 0000000000..c07bb893de --- /dev/null +++ b/Tests/RunCMake/include/CMP0188-WARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at CMP0188-WARN\.cmake:[0-9]+ \(include\): + Policy CMP0188 is not set: The FindGCCXML module is removed\. Run "cmake + --help-policy CMP0188" 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/include/CMP0188-WARN.cmake b/Tests/RunCMake/include/CMP0188-WARN.cmake new file mode 100644 index 0000000000..99d35576e1 --- /dev/null +++ b/Tests/RunCMake/include/CMP0188-WARN.cmake @@ -0,0 +1,7 @@ +# Do not set CMP0188. +set(_FindGCCXML_testing 1) +include(FindGCCXML) + +if(NOT _FindGCCXML_included) + message(FATAL_ERROR "FindGCCXML.cmake not included") +endif() diff --git a/Tests/RunCMake/include/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake index 68a08bbf31..994f2a552e 100644 --- a/Tests/RunCMake/include/RunCMakeTest.cmake +++ b/Tests/RunCMake/include/RunCMakeTest.cmake @@ -25,3 +25,8 @@ run_cmake(CMP0167-OLD) run_cmake(CMP0167-WARN) run_cmake(CMP0167-NEW-name) run_cmake(CMP0167-NEW-path) + +run_cmake(CMP0188-OLD) +run_cmake(CMP0188-WARN) +run_cmake(CMP0188-NEW-name) +run_cmake(CMP0188-NEW-path)