Merge topic 'remove-FindGCCXML'

2123244746 FindGCCXML: Add policy to remove this module

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10359
This commit is contained in:
Brad King 2025-02-18 14:51:11 +00:00 committed by Kitware Robot
commit d2cda92936
23 changed files with 127 additions and 6 deletions

View File

@ -98,6 +98,7 @@ Policies Introduced by CMake 4.1
.. toctree::
:maxdepth: 1
CMP0188: The FindGCCXML module is removed. </policy/CMP0188>
CMP0187: Include source file without an extension after the same name with an extension. </policy/CMP0187>
CMP0186: Regular expressions match ^ at most once in repeated searches. </policy/CMP0186>

21
Help/policy/CMP0188.rst Normal file
View File

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

View File

@ -0,0 +1,5 @@
remove-FindGCCXML
-----------------
* The :module:`FindGCCXML` module has been deprecated via policy
:policy:`CMP0188`. Port projects to CastXML instead.

View File

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

View File

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

View File

@ -25,6 +25,7 @@ bool cmIncludeCommand(std::vector<std::string> 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;

View File

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

View File

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

View File

@ -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()

View File

@ -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()

View File

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

View File

@ -0,0 +1,6 @@
set(_FindGCCXML_testing TRUE)
find_package(GCCXML MODULE)
if(NOT _FindGCCXML_included)
message(FATAL_ERROR "FindGCCXML.cmake not included")
endif()

View File

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

View File

@ -0,0 +1 @@
1

View File

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

View File

@ -0,0 +1,2 @@
cmake_policy(SET CMP0188 NEW)
include(FindGCCXML)

View File

@ -0,0 +1 @@
1

View File

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

View File

@ -0,0 +1,2 @@
cmake_policy(SET CMP0188 NEW)
include(${CMAKE_ROOT}/Modules/FindGCCXML.cmake)

View File

@ -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()

View File

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

View File

@ -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()

View File

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