Merge topic 'FindCUDA-remove'

2c146a7fc5 FindCUDA: Add policy to remove this module

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8306
This commit is contained in:
Brad King
2023-03-10 16:02:00 +00:00
committed by Kitware Robot
23 changed files with 137 additions and 2 deletions

View File

@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.27
.. toctree::
:maxdepth: 1
CMP0146: The FindCUDA module is removed. </policy/CMP0146>
CMP0145: The Dart and FindDart modules are removed. </policy/CMP0145>
CMP0144: find_package uses upper-case PACKAGENAME_ROOT variables. </policy/CMP0144>

29
Help/policy/CMP0146.rst Normal file
View File

@@ -0,0 +1,29 @@
CMP0146
-------
.. versionadded:: 3.27
The :module:`FindCUDA` module is removed.
The :module:`FindCUDA` module has been deprecated since CMake 3.10.
CMake 3.27 and above prefer to not provide the module.
This policy provides compatibility for projects that have not been
ported away from it.
Projects using the :module:`FindCUDA` module should be updated to use
CMake's first-class ``CUDA`` language support. List ``CUDA`` among the
languages named in the top-level call to the :command:`project` command,
or call the :command:`enable_language` command with ``CUDA``.
Then one can add CUDA (``.cu``) sources directly to targets,
similar to other languages.
The ``OLD`` behavior of this policy is for ``find_package(CUDA)`` to
load the deprecated module. The ``NEW`` behavior is for uses of the
module to fail as if it does 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

View File

@@ -0,0 +1,6 @@
FindCUDA-remove
---------------
* The :module:`FindCUDA` module has been fully deprecated via policy
:policy:`CMP0146`. Port projects to CMake's first-class ``CUDA``
language support.

View File

@@ -2,7 +2,12 @@
FindCUDA
--------
.. warning:: *Deprecated since version 3.10.*
.. versionchanged:: 3.27
This module is available only if policy :policy:`CMP0146` is not set to ``NEW``.
Port projects to CMake's first-class ``CUDA`` language support.
.. deprecated:: 3.10
Do not use this module in new code.
It is no longer necessary to use this module or call ``find_package(CUDA)``
for compiling CUDA code. Instead, list ``CUDA`` among the languages named
@@ -555,6 +560,16 @@ The script defines the following variables:
#
###############################################################################
cmake_policy(GET CMP0146 _FindCUDA_CMP0146)
if(_FindCUDA_CMP0146 STREQUAL "NEW")
message(FATAL_ERROR "The FindCUDA module has been removed by policy CMP0146.")
endif()
if(_FindCUDA_testing)
set(_FindCUDA_included TRUE)
return()
endif()
# FindCUDA.cmake
# This macro helps us find the location of helper files we will need the full path to

View File

@@ -502,6 +502,7 @@ cmFindPackageCommand::cmFindPackageCommand(cmExecutionStatus& status)
this->DebugMode = false;
this->AppendSearchPathGroups();
this->DeprecatedFindModules["CUDA"] = cmPolicies::CMP0146;
this->DeprecatedFindModules["Dart"] = cmPolicies::CMP0145;
this->DeprecatedFindModules["Qt"] = cmPolicies::CMP0084;
}

View File

@@ -22,6 +22,7 @@ bool cmIncludeCommand(std::vector<std::string> const& args,
if (DeprecatedModules.empty()) {
DeprecatedModules["Dart"] = cmPolicies::CMP0145;
DeprecatedModules["Documentation"] = cmPolicies::CMP0106;
DeprecatedModules["FindCUDA"] = cmPolicies::CMP0146;
DeprecatedModules["FindDart"] = cmPolicies::CMP0145;
DeprecatedModules["WriteCompilerDetectionHeader"] = cmPolicies::CMP0120;
}

View File

@@ -439,7 +439,9 @@ class cmMakefile;
"find_package uses upper-case <PACKAGENAME>_ROOT variables.", 3, 27, \
0, cmPolicies::WARN) \
SELECT(POLICY, CMP0145, "The Dart and FindDart modules are removed.", 3, \
27, 0, cmPolicies::WARN)
27, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0146, "The FindCUDA module is 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) \

View File

@@ -0,0 +1,4 @@
^CMake Warning at CMP0146-NEW\.cmake:[0-9]+ \(find_package\):
No "FindCUDA\.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 CMP0146 NEW)
set(_FindCUDA_testing TRUE)
find_package(CUDA MODULE)
if(_FindCUDA_included)
message(FATAL_ERROR "FindCUDA.cmake erroneously included")
endif()

View File

@@ -0,0 +1,7 @@
cmake_policy(SET CMP0146 OLD)
set(_FindCUDA_testing TRUE)
find_package(CUDA MODULE)
if(NOT _FindCUDA_included)
message(FATAL_ERROR "FindCUDA.cmake not included")
endif()

View File

@@ -0,0 +1,8 @@
CMake Warning \(dev\) at CMP0146-WARN\.cmake:[0-9]+ \(find_package\):
Policy CMP0146 is not set: The FindCUDA module is removed\. Run "cmake
--help-policy CMP0146" 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(_FindCUDA_testing TRUE)
find_package(CUDA MODULE)
if(NOT _FindCUDA_included)
message(FATAL_ERROR "FindCUDA.cmake not included")
endif()

View File

@@ -39,6 +39,9 @@ run_cmake(CMP0084-NEW)
run_cmake(CMP0145-OLD)
run_cmake(CMP0145-WARN)
run_cmake(CMP0145-NEW)
run_cmake(CMP0146-OLD)
run_cmake(CMP0146-WARN)
run_cmake(CMP0146-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 CMP0146-NEW-name\.cmake:[0-9]+ \(include\):
include could not find requested file:
FindCUDA
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)$

View File

@@ -0,0 +1,2 @@
cmake_policy(SET CMP0146 NEW)
include(FindCUDA)

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,6 @@
^CMake Error at [^
]*/Modules/FindCUDA.cmake:[0-9]+ \(message\):
The FindCUDA module has been removed by policy CMP0146\.
Call Stack \(most recent call first\):
CMP0146-NEW-path\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)$

View File

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

View File

@@ -0,0 +1,7 @@
cmake_policy(SET CMP0146 OLD)
set(_FindCUDA_testing 1)
include(FindCUDA)
if(NOT _FindCUDA_included)
message(FATAL_ERROR "FindCUDA.cmake not included")
endif()

View File

@@ -0,0 +1,8 @@
^CMake Warning \(dev\) at CMP0146-WARN\.cmake:[0-9]+ \(include\):
Policy CMP0146 is not set: The FindCUDA module is removed\. Run "cmake
--help-policy CMP0146" 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 CMP0146.
set(_FindCUDA_testing 1)
include(FindCUDA)
if(NOT _FindCUDA_included)
message(FATAL_ERROR "FindCUDA.cmake not included")
endif()

View File

@@ -7,3 +7,8 @@ run_cmake(CMP0024-NEW)
run_cmake(ExportExportInclude)
run_cmake(IncludeIsDirectory)
run_cmake(IncludeMalformed)
run_cmake(CMP0146-OLD)
run_cmake(CMP0146-WARN)
run_cmake(CMP0146-NEW-name)
run_cmake(CMP0146-NEW-path)