mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-08 00:30:48 +00:00
FindCUDA: Add policy to remove this module
The `FindCUDA` module has been deprecated since CMake 3.10. Add a policy to pretend it doesn't exist in order to encourage projects to port away from it.
This commit is contained in:
@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.27
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
|
CMP0146: The FindCUDA module is removed. </policy/CMP0146>
|
||||||
CMP0145: The Dart and FindDart modules are removed. </policy/CMP0145>
|
CMP0145: The Dart and FindDart modules are removed. </policy/CMP0145>
|
||||||
CMP0144: find_package uses upper-case PACKAGENAME_ROOT variables. </policy/CMP0144>
|
CMP0144: find_package uses upper-case PACKAGENAME_ROOT variables. </policy/CMP0144>
|
||||||
|
|
||||||
|
|||||||
29
Help/policy/CMP0146.rst
Normal file
29
Help/policy/CMP0146.rst
Normal 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
|
||||||
6
Help/release/dev/FindCUDA-remove.rst
Normal file
6
Help/release/dev/FindCUDA-remove.rst
Normal 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.
|
||||||
@@ -2,7 +2,12 @@
|
|||||||
FindCUDA
|
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)``
|
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
|
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
|
# FindCUDA.cmake
|
||||||
|
|
||||||
# This macro helps us find the location of helper files we will need the full path to
|
# This macro helps us find the location of helper files we will need the full path to
|
||||||
|
|||||||
@@ -502,6 +502,7 @@ cmFindPackageCommand::cmFindPackageCommand(cmExecutionStatus& status)
|
|||||||
this->DebugMode = false;
|
this->DebugMode = false;
|
||||||
this->AppendSearchPathGroups();
|
this->AppendSearchPathGroups();
|
||||||
|
|
||||||
|
this->DeprecatedFindModules["CUDA"] = cmPolicies::CMP0146;
|
||||||
this->DeprecatedFindModules["Dart"] = cmPolicies::CMP0145;
|
this->DeprecatedFindModules["Dart"] = cmPolicies::CMP0145;
|
||||||
this->DeprecatedFindModules["Qt"] = cmPolicies::CMP0084;
|
this->DeprecatedFindModules["Qt"] = cmPolicies::CMP0084;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ bool cmIncludeCommand(std::vector<std::string> const& args,
|
|||||||
if (DeprecatedModules.empty()) {
|
if (DeprecatedModules.empty()) {
|
||||||
DeprecatedModules["Dart"] = cmPolicies::CMP0145;
|
DeprecatedModules["Dart"] = cmPolicies::CMP0145;
|
||||||
DeprecatedModules["Documentation"] = cmPolicies::CMP0106;
|
DeprecatedModules["Documentation"] = cmPolicies::CMP0106;
|
||||||
|
DeprecatedModules["FindCUDA"] = cmPolicies::CMP0146;
|
||||||
DeprecatedModules["FindDart"] = cmPolicies::CMP0145;
|
DeprecatedModules["FindDart"] = cmPolicies::CMP0145;
|
||||||
DeprecatedModules["WriteCompilerDetectionHeader"] = cmPolicies::CMP0120;
|
DeprecatedModules["WriteCompilerDetectionHeader"] = cmPolicies::CMP0120;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -439,7 +439,9 @@ class cmMakefile;
|
|||||||
"find_package uses upper-case <PACKAGENAME>_ROOT variables.", 3, 27, \
|
"find_package uses upper-case <PACKAGENAME>_ROOT variables.", 3, 27, \
|
||||||
0, cmPolicies::WARN) \
|
0, cmPolicies::WARN) \
|
||||||
SELECT(POLICY, CMP0145, "The Dart and FindDart modules are removed.", 3, \
|
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_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
|
||||||
#define CM_FOR_EACH_POLICY_ID(POLICY) \
|
#define CM_FOR_EACH_POLICY_ID(POLICY) \
|
||||||
|
|||||||
4
Tests/RunCMake/find_package/CMP0146-NEW-stderr.txt
Normal file
4
Tests/RunCMake/find_package/CMP0146-NEW-stderr.txt
Normal 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\)
|
||||||
7
Tests/RunCMake/find_package/CMP0146-NEW.cmake
Normal file
7
Tests/RunCMake/find_package/CMP0146-NEW.cmake
Normal 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()
|
||||||
7
Tests/RunCMake/find_package/CMP0146-OLD.cmake
Normal file
7
Tests/RunCMake/find_package/CMP0146-OLD.cmake
Normal 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()
|
||||||
8
Tests/RunCMake/find_package/CMP0146-WARN-stderr.txt
Normal file
8
Tests/RunCMake/find_package/CMP0146-WARN-stderr.txt
Normal 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\.$
|
||||||
6
Tests/RunCMake/find_package/CMP0146-WARN.cmake
Normal file
6
Tests/RunCMake/find_package/CMP0146-WARN.cmake
Normal 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()
|
||||||
@@ -39,6 +39,9 @@ run_cmake(CMP0084-NEW)
|
|||||||
run_cmake(CMP0145-OLD)
|
run_cmake(CMP0145-OLD)
|
||||||
run_cmake(CMP0145-WARN)
|
run_cmake(CMP0145-WARN)
|
||||||
run_cmake(CMP0145-NEW)
|
run_cmake(CMP0145-NEW)
|
||||||
|
run_cmake(CMP0146-OLD)
|
||||||
|
run_cmake(CMP0146-WARN)
|
||||||
|
run_cmake(CMP0146-NEW)
|
||||||
run_cmake(WrongVersionRange)
|
run_cmake(WrongVersionRange)
|
||||||
run_cmake(EmptyVersionRange)
|
run_cmake(EmptyVersionRange)
|
||||||
run_cmake(VersionRangeWithEXACT)
|
run_cmake(VersionRangeWithEXACT)
|
||||||
|
|||||||
1
Tests/RunCMake/include/CMP0146-NEW-name-result.txt
Normal file
1
Tests/RunCMake/include/CMP0146-NEW-name-result.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1
|
||||||
6
Tests/RunCMake/include/CMP0146-NEW-name-stderr.txt
Normal file
6
Tests/RunCMake/include/CMP0146-NEW-name-stderr.txt
Normal 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\)$
|
||||||
2
Tests/RunCMake/include/CMP0146-NEW-name.cmake
Normal file
2
Tests/RunCMake/include/CMP0146-NEW-name.cmake
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cmake_policy(SET CMP0146 NEW)
|
||||||
|
include(FindCUDA)
|
||||||
1
Tests/RunCMake/include/CMP0146-NEW-path-result.txt
Normal file
1
Tests/RunCMake/include/CMP0146-NEW-path-result.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1
|
||||||
6
Tests/RunCMake/include/CMP0146-NEW-path-stderr.txt
Normal file
6
Tests/RunCMake/include/CMP0146-NEW-path-stderr.txt
Normal 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\)$
|
||||||
2
Tests/RunCMake/include/CMP0146-NEW-path.cmake
Normal file
2
Tests/RunCMake/include/CMP0146-NEW-path.cmake
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cmake_policy(SET CMP0146 NEW)
|
||||||
|
include(${CMAKE_ROOT}/Modules/FindCUDA.cmake)
|
||||||
7
Tests/RunCMake/include/CMP0146-OLD.cmake
Normal file
7
Tests/RunCMake/include/CMP0146-OLD.cmake
Normal 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()
|
||||||
8
Tests/RunCMake/include/CMP0146-WARN-stderr.txt
Normal file
8
Tests/RunCMake/include/CMP0146-WARN-stderr.txt
Normal 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\.$
|
||||||
7
Tests/RunCMake/include/CMP0146-WARN.cmake
Normal file
7
Tests/RunCMake/include/CMP0146-WARN.cmake
Normal 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()
|
||||||
@@ -7,3 +7,8 @@ run_cmake(CMP0024-NEW)
|
|||||||
run_cmake(ExportExportInclude)
|
run_cmake(ExportExportInclude)
|
||||||
run_cmake(IncludeIsDirectory)
|
run_cmake(IncludeIsDirectory)
|
||||||
run_cmake(IncludeMalformed)
|
run_cmake(IncludeMalformed)
|
||||||
|
|
||||||
|
run_cmake(CMP0146-OLD)
|
||||||
|
run_cmake(CMP0146-WARN)
|
||||||
|
run_cmake(CMP0146-NEW-name)
|
||||||
|
run_cmake(CMP0146-NEW-path)
|
||||||
|
|||||||
Reference in New Issue
Block a user