summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-30 14:13:07 (GMT)
committerBrad King <brad.king@kitware.com>2023-03-30 16:05:09 (GMT)
commita4c5b91f80003d007cddbb0de95032d65ec98ace (patch)
tree591d68a94107253b48f6398a3188e1c89169e0c8
parent4901fdb201bc6264e976e105780a490d9c0eba19 (diff)
downloadCMake-a4c5b91f80003d007cddbb0de95032d65ec98ace.zip
CMake-a4c5b91f80003d007cddbb0de95032d65ec98ace.tar.gz
CMake-a4c5b91f80003d007cddbb0de95032d65ec98ace.tar.bz2
FindPython{Interp,Libs}: Add policy to remove these modules
The `FindPythonInterp` and `FindPythonLibs` modules have been deprecated since CMake 3.12. Add a policy to pretend they do not exist in order to encourage projects to port to `FindPython` or `FindPython{2,3}`.
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/policy/CMP0148.rst29
-rw-r--r--Help/release/dev/remove-FindPythonInterp-FindPythonLibs.rst6
-rw-r--r--Modules/FindPythonInterp.cmake13
-rw-r--r--Modules/FindPythonLibs.cmake13
-rw-r--r--Source/cmFindPackageCommand.cxx2
-rw-r--r--Source/cmIncludeCommand.cxx2
-rw-r--r--Source/cmPolicies.h3
-rw-r--r--Tests/RunCMake/find_package/CMP0148-Interp-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/find_package/CMP0148-Interp-NEW.cmake7
-rw-r--r--Tests/RunCMake/find_package/CMP0148-Interp-OLD.cmake7
-rw-r--r--Tests/RunCMake/find_package/CMP0148-Interp-WARN-stderr.txt8
-rw-r--r--Tests/RunCMake/find_package/CMP0148-Interp-WARN.cmake6
-rw-r--r--Tests/RunCMake/find_package/CMP0148-Libs-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/find_package/CMP0148-Libs-NEW.cmake7
-rw-r--r--Tests/RunCMake/find_package/CMP0148-Libs-OLD.cmake7
-rw-r--r--Tests/RunCMake/find_package/CMP0148-Libs-WARN-stderr.txt8
-rw-r--r--Tests/RunCMake/find_package/CMP0148-Libs-WARN.cmake6
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/include/CMP0148-Interp-NEW-name-result.txt1
-rw-r--r--Tests/RunCMake/include/CMP0148-Interp-NEW-name-stderr.txt6
-rw-r--r--Tests/RunCMake/include/CMP0148-Interp-NEW-name.cmake2
-rw-r--r--Tests/RunCMake/include/CMP0148-Interp-NEW-path-result.txt1
-rw-r--r--Tests/RunCMake/include/CMP0148-Interp-NEW-path-stderr.txt6
-rw-r--r--Tests/RunCMake/include/CMP0148-Interp-NEW-path.cmake2
-rw-r--r--Tests/RunCMake/include/CMP0148-Interp-OLD.cmake7
-rw-r--r--Tests/RunCMake/include/CMP0148-Interp-WARN-stderr.txt8
-rw-r--r--Tests/RunCMake/include/CMP0148-Interp-WARN.cmake7
-rw-r--r--Tests/RunCMake/include/CMP0148-Libs-NEW-name-result.txt1
-rw-r--r--Tests/RunCMake/include/CMP0148-Libs-NEW-name-stderr.txt6
-rw-r--r--Tests/RunCMake/include/CMP0148-Libs-NEW-name.cmake2
-rw-r--r--Tests/RunCMake/include/CMP0148-Libs-NEW-path-result.txt1
-rw-r--r--Tests/RunCMake/include/CMP0148-Libs-NEW-path-stderr.txt6
-rw-r--r--Tests/RunCMake/include/CMP0148-Libs-NEW-path.cmake2
-rw-r--r--Tests/RunCMake/include/CMP0148-Libs-OLD.cmake7
-rw-r--r--Tests/RunCMake/include/CMP0148-Libs-WARN-stderr.txt8
-rw-r--r--Tests/RunCMake/include/CMP0148-Libs-WARN.cmake7
-rw-r--r--Tests/RunCMake/include/RunCMakeTest.cmake9
38 files changed, 228 insertions, 0 deletions
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index a37a45c..158bf62 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
+ CMP0148: The FindPythonInterp and FindPythonLibs modules are removed. </policy/CMP0148>
CMP0147: Visual Studio generators build custom commands in parallel. </policy/CMP0147>
CMP0146: The FindCUDA module is removed. </policy/CMP0146>
CMP0145: The Dart and FindDart modules are removed. </policy/CMP0145>
diff --git a/Help/policy/CMP0148.rst b/Help/policy/CMP0148.rst
new file mode 100644
index 0000000..2f5c43d
--- /dev/null
+++ b/Help/policy/CMP0148.rst
@@ -0,0 +1,29 @@
+CMP0148
+-------
+
+.. versionadded:: 3.27
+
+The :module:`FindPythonInterp` and :module:`FindPythonLibs` modules are removed.
+
+These modules have been deprecated since CMake 3.12.
+CMake 3.27 and above prefer to not provide the modules.
+This policy provides compatibility for projects that have not been
+ported away from them.
+
+Projects using the :module:`FindPythonInterp` and/or :module:`FindPythonLibs`
+modules should be updated to use one of their replacements:
+
+* :module:`FindPython3`
+* :module:`FindPython2`
+* :module:`FindPython`
+
+The ``OLD`` behavior of this policy is for ``find_package(PythonInterp)``
+and ``find_package(PythonLibs)`` 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-FindPythonInterp-FindPythonLibs.rst b/Help/release/dev/remove-FindPythonInterp-FindPythonLibs.rst
new file mode 100644
index 0000000..426febb
--- /dev/null
+++ b/Help/release/dev/remove-FindPythonInterp-FindPythonLibs.rst
@@ -0,0 +1,6 @@
+remove-FindPythonInterp-FindPythonLibs
+--------------------------------------
+
+* The :module:`FindPythonInterp` and :module:`FindPythonLibs` modules have
+ been fully deprecated via policy :policy:`CMP0148`. Port projects to
+ :module:`FindPython3`, :module:`FindPython2`, or :module:`FindPython`.
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 7ad3587..b5e759d 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -5,6 +5,9 @@
FindPythonInterp
----------------
+.. versionchanged:: 3.27
+ This module is available only if policy :policy:`CMP0148` is not set to ``NEW``.
+
.. deprecated:: 3.12
Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead.
@@ -50,6 +53,16 @@ of PYTHON_LIBRARIES.
#]=======================================================================]
+cmake_policy(GET CMP0148 _FindPythonInterp_CMP0148)
+if(_FindPythonInterp_CMP0148 STREQUAL "NEW")
+ message(FATAL_ERROR "The FindPythonInterp module has been removed by policy CMP0148.")
+endif()
+
+if(_FindPythonInterp_testing)
+ set(_FindPythonInterp_included TRUE)
+ return()
+endif()
+
unset(_Python_NAMES)
set(_PYTHON1_VERSIONS 1.6 1.5)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 43a84dd..06004ee 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -5,6 +5,9 @@
FindPythonLibs
--------------
+.. versionchanged:: 3.27
+ This module is available only if policy :policy:`CMP0148` is not set to ``NEW``.
+
.. deprecated:: 3.12
Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead.
@@ -45,6 +48,16 @@ get the currently active Python version by default with a consistent version
of PYTHON_LIBRARIES.
#]=======================================================================]
+cmake_policy(GET CMP0148 _FindPythonLibs_CMP0148)
+if(_FindPythonLibs_CMP0148 STREQUAL "NEW")
+ message(FATAL_ERROR "The FindPythonLibs module has been removed by policy CMP0148.")
+endif()
+
+if(_FindPythonLibs_testing)
+ set(_FindPythonLibs_included TRUE)
+ return()
+endif()
+
# Use the executable's path as a hint
set(_Python_LIBRARY_PATH_HINT)
if(IS_ABSOLUTE "${PYTHON_EXECUTABLE}")
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 355ca58..b1029e6 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -549,6 +549,8 @@ cmFindPackageCommand::cmFindPackageCommand(cmExecutionStatus& status)
this->DeprecatedFindModules["CUDA"] = cmPolicies::CMP0146;
this->DeprecatedFindModules["Dart"] = cmPolicies::CMP0145;
+ 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 56883fb..3695a9b 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -24,6 +24,8 @@ bool cmIncludeCommand(std::vector<std::string> const& args,
DeprecatedModules["Documentation"] = cmPolicies::CMP0106;
DeprecatedModules["FindCUDA"] = cmPolicies::CMP0146;
DeprecatedModules["FindDart"] = cmPolicies::CMP0145;
+ DeprecatedModules["FindPythonInterp"] = cmPolicies::CMP0148;
+ DeprecatedModules["FindPythonLibs"] = cmPolicies::CMP0148;
DeprecatedModules["WriteCompilerDetectionHeader"] = cmPolicies::CMP0120;
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 52993b8..37d697f 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -444,6 +444,9 @@ class cmMakefile;
cmPolicies::WARN) \
SELECT(POLICY, CMP0147, \
"Visual Studio generators build custom commands in parallel.", 3, \
+ 27, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0148, \
+ "The FindPythonInterp and FindPythonLibs modules are removed.", 3, \
27, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
diff --git a/Tests/RunCMake/find_package/CMP0148-Interp-NEW-stderr.txt b/Tests/RunCMake/find_package/CMP0148-Interp-NEW-stderr.txt
new file mode 100644
index 0000000..68b40f7
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0148-Interp-NEW-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Warning at CMP0148-Interp-NEW\.cmake:[0-9]+ \(find_package\):
+ No "FindPythonInterp\.cmake" found in CMAKE_MODULE_PATH\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_package/CMP0148-Interp-NEW.cmake b/Tests/RunCMake/find_package/CMP0148-Interp-NEW.cmake
new file mode 100644
index 0000000..ccd04f5
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0148-Interp-NEW.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0148 NEW)
+set(_FindPythonInterp_testing TRUE)
+find_package(PythonInterp MODULE)
+
+if(_FindPythonInterp_included)
+ message(FATAL_ERROR "FindPythonInterp.cmake erroneously included")
+endif()
diff --git a/Tests/RunCMake/find_package/CMP0148-Interp-OLD.cmake b/Tests/RunCMake/find_package/CMP0148-Interp-OLD.cmake
new file mode 100644
index 0000000..1879d19
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0148-Interp-OLD.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0148 OLD)
+set(_FindPythonInterp_testing TRUE)
+find_package(PythonInterp MODULE)
+
+if(NOT _FindPythonInterp_included)
+ message(FATAL_ERROR "FindPythonInterp.cmake not included")
+endif()
diff --git a/Tests/RunCMake/find_package/CMP0148-Interp-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0148-Interp-WARN-stderr.txt
new file mode 100644
index 0000000..2666c22
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0148-Interp-WARN-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) at CMP0148-Interp-WARN\.cmake:[0-9]+ \(find_package\):
+ Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
+ are removed\. Run "cmake --help-policy CMP0148" 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/CMP0148-Interp-WARN.cmake b/Tests/RunCMake/find_package/CMP0148-Interp-WARN.cmake
new file mode 100644
index 0000000..53b60af
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0148-Interp-WARN.cmake
@@ -0,0 +1,6 @@
+set(_FindPythonInterp_testing TRUE)
+find_package(PythonInterp MODULE)
+
+if(NOT _FindPythonInterp_included)
+ message(FATAL_ERROR "FindPythonInterp.cmake not included")
+endif()
diff --git a/Tests/RunCMake/find_package/CMP0148-Libs-NEW-stderr.txt b/Tests/RunCMake/find_package/CMP0148-Libs-NEW-stderr.txt
new file mode 100644
index 0000000..d92b434
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0148-Libs-NEW-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Warning at CMP0148-Libs-NEW\.cmake:[0-9]+ \(find_package\):
+ No "FindPythonLibs\.cmake" found in CMAKE_MODULE_PATH\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_package/CMP0148-Libs-NEW.cmake b/Tests/RunCMake/find_package/CMP0148-Libs-NEW.cmake
new file mode 100644
index 0000000..2ef8c46
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0148-Libs-NEW.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0148 NEW)
+set(_FindPythonLibs_testing TRUE)
+find_package(PythonLibs MODULE)
+
+if(_FindPythonLibs_included)
+ message(FATAL_ERROR "FindPythonLibs.cmake erroneously included")
+endif()
diff --git a/Tests/RunCMake/find_package/CMP0148-Libs-OLD.cmake b/Tests/RunCMake/find_package/CMP0148-Libs-OLD.cmake
new file mode 100644
index 0000000..06fd6a6
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0148-Libs-OLD.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0148 OLD)
+set(_FindPythonLibs_testing TRUE)
+find_package(PythonLibs MODULE)
+
+if(NOT _FindPythonLibs_included)
+ message(FATAL_ERROR "FindPythonLibs.cmake not included")
+endif()
diff --git a/Tests/RunCMake/find_package/CMP0148-Libs-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0148-Libs-WARN-stderr.txt
new file mode 100644
index 0000000..5210e51
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0148-Libs-WARN-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) at CMP0148-Libs-WARN\.cmake:[0-9]+ \(find_package\):
+ Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
+ are removed\. Run "cmake --help-policy CMP0148" 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/CMP0148-Libs-WARN.cmake b/Tests/RunCMake/find_package/CMP0148-Libs-WARN.cmake
new file mode 100644
index 0000000..9bbe066
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0148-Libs-WARN.cmake
@@ -0,0 +1,6 @@
+set(_FindPythonLibs_testing TRUE)
+find_package(PythonLibs MODULE)
+
+if(NOT _FindPythonLibs_included)
+ message(FATAL_ERROR "FindPythonLibs.cmake not included")
+endif()
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 26eb908..006757a 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -47,6 +47,12 @@ if(RunCMake_GENERATOR MATCHES "Visual Studio")
run_cmake(CMP0147-WARN)
run_cmake(CMP0147-NEW)
endif()
+run_cmake(CMP0148-Interp-OLD)
+run_cmake(CMP0148-Interp-WARN)
+run_cmake(CMP0148-Interp-NEW)
+run_cmake(CMP0148-Libs-OLD)
+run_cmake(CMP0148-Libs-WARN)
+run_cmake(CMP0148-Libs-NEW)
run_cmake(WrongVersionRange)
run_cmake(EmptyVersionRange)
run_cmake(VersionRangeWithEXACT)
diff --git a/Tests/RunCMake/include/CMP0148-Interp-NEW-name-result.txt b/Tests/RunCMake/include/CMP0148-Interp-NEW-name-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Interp-NEW-name-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/include/CMP0148-Interp-NEW-name-stderr.txt b/Tests/RunCMake/include/CMP0148-Interp-NEW-name-stderr.txt
new file mode 100644
index 0000000..8627c2e
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Interp-NEW-name-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at CMP0148-Interp-NEW-name\.cmake:[0-9]+ \(include\):
+ include could not find requested file:
+
+ FindPythonInterp
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/include/CMP0148-Interp-NEW-name.cmake b/Tests/RunCMake/include/CMP0148-Interp-NEW-name.cmake
new file mode 100644
index 0000000..7d73dc4
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Interp-NEW-name.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0148 NEW)
+include(FindPythonInterp)
diff --git a/Tests/RunCMake/include/CMP0148-Interp-NEW-path-result.txt b/Tests/RunCMake/include/CMP0148-Interp-NEW-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Interp-NEW-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/include/CMP0148-Interp-NEW-path-stderr.txt b/Tests/RunCMake/include/CMP0148-Interp-NEW-path-stderr.txt
new file mode 100644
index 0000000..0b0f29d
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Interp-NEW-path-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at [^
+]*/Modules/FindPythonInterp.cmake:[0-9]+ \(message\):
+ The FindPythonInterp module has been removed by policy CMP0148\.
+Call Stack \(most recent call first\):
+ CMP0148-Interp-NEW-path\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/include/CMP0148-Interp-NEW-path.cmake b/Tests/RunCMake/include/CMP0148-Interp-NEW-path.cmake
new file mode 100644
index 0000000..1f8630e
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Interp-NEW-path.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0148 NEW)
+include(${CMAKE_ROOT}/Modules/FindPythonInterp.cmake)
diff --git a/Tests/RunCMake/include/CMP0148-Interp-OLD.cmake b/Tests/RunCMake/include/CMP0148-Interp-OLD.cmake
new file mode 100644
index 0000000..8905221
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Interp-OLD.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0148 OLD)
+set(_FindPythonInterp_testing 1)
+include(FindPythonInterp)
+
+if(NOT _FindPythonInterp_included)
+ message(FATAL_ERROR "FindPythonInterp.cmake not included")
+endif()
diff --git a/Tests/RunCMake/include/CMP0148-Interp-WARN-stderr.txt b/Tests/RunCMake/include/CMP0148-Interp-WARN-stderr.txt
new file mode 100644
index 0000000..5bd6935
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Interp-WARN-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Warning \(dev\) at CMP0148-Interp-WARN\.cmake:[0-9]+ \(include\):
+ Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
+ are removed\. Run "cmake --help-policy CMP0148" 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/CMP0148-Interp-WARN.cmake b/Tests/RunCMake/include/CMP0148-Interp-WARN.cmake
new file mode 100644
index 0000000..18f302d
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Interp-WARN.cmake
@@ -0,0 +1,7 @@
+# Do not set CMP0148.
+set(_FindPythonInterp_testing 1)
+include(FindPythonInterp)
+
+if(NOT _FindPythonInterp_included)
+ message(FATAL_ERROR "FindPythonInterp.cmake not included")
+endif()
diff --git a/Tests/RunCMake/include/CMP0148-Libs-NEW-name-result.txt b/Tests/RunCMake/include/CMP0148-Libs-NEW-name-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Libs-NEW-name-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/include/CMP0148-Libs-NEW-name-stderr.txt b/Tests/RunCMake/include/CMP0148-Libs-NEW-name-stderr.txt
new file mode 100644
index 0000000..4e1f97c
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Libs-NEW-name-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at CMP0148-Libs-NEW-name\.cmake:[0-9]+ \(include\):
+ include could not find requested file:
+
+ FindPythonLibs
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/include/CMP0148-Libs-NEW-name.cmake b/Tests/RunCMake/include/CMP0148-Libs-NEW-name.cmake
new file mode 100644
index 0000000..c9877bc
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Libs-NEW-name.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0148 NEW)
+include(FindPythonLibs)
diff --git a/Tests/RunCMake/include/CMP0148-Libs-NEW-path-result.txt b/Tests/RunCMake/include/CMP0148-Libs-NEW-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Libs-NEW-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/include/CMP0148-Libs-NEW-path-stderr.txt b/Tests/RunCMake/include/CMP0148-Libs-NEW-path-stderr.txt
new file mode 100644
index 0000000..5f1037d
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Libs-NEW-path-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at [^
+]*/Modules/FindPythonLibs.cmake:[0-9]+ \(message\):
+ The FindPythonLibs module has been removed by policy CMP0148\.
+Call Stack \(most recent call first\):
+ CMP0148-Libs-NEW-path\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/include/CMP0148-Libs-NEW-path.cmake b/Tests/RunCMake/include/CMP0148-Libs-NEW-path.cmake
new file mode 100644
index 0000000..29b315f
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Libs-NEW-path.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0148 NEW)
+include(${CMAKE_ROOT}/Modules/FindPythonLibs.cmake)
diff --git a/Tests/RunCMake/include/CMP0148-Libs-OLD.cmake b/Tests/RunCMake/include/CMP0148-Libs-OLD.cmake
new file mode 100644
index 0000000..b69e160
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Libs-OLD.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0148 OLD)
+set(_FindPythonLibs_testing 1)
+include(FindPythonLibs)
+
+if(NOT _FindPythonLibs_included)
+ message(FATAL_ERROR "FindPythonLibs.cmake not included")
+endif()
diff --git a/Tests/RunCMake/include/CMP0148-Libs-WARN-stderr.txt b/Tests/RunCMake/include/CMP0148-Libs-WARN-stderr.txt
new file mode 100644
index 0000000..c24abd4
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Libs-WARN-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Warning \(dev\) at CMP0148-Libs-WARN\.cmake:[0-9]+ \(include\):
+ Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
+ are removed\. Run "cmake --help-policy CMP0148" 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/CMP0148-Libs-WARN.cmake b/Tests/RunCMake/include/CMP0148-Libs-WARN.cmake
new file mode 100644
index 0000000..d8dc00c
--- /dev/null
+++ b/Tests/RunCMake/include/CMP0148-Libs-WARN.cmake
@@ -0,0 +1,7 @@
+# Do not set CMP0148.
+set(_FindPythonLibs_testing 1)
+include(FindPythonLibs)
+
+if(NOT _FindPythonLibs_included)
+ message(FATAL_ERROR "FindPythonLibs.cmake not included")
+endif()
diff --git a/Tests/RunCMake/include/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake
index b6fdb54..685173e 100644
--- a/Tests/RunCMake/include/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include/RunCMakeTest.cmake
@@ -12,3 +12,12 @@ run_cmake(CMP0146-OLD)
run_cmake(CMP0146-WARN)
run_cmake(CMP0146-NEW-name)
run_cmake(CMP0146-NEW-path)
+
+run_cmake(CMP0148-Interp-OLD)
+run_cmake(CMP0148-Interp-WARN)
+run_cmake(CMP0148-Interp-NEW-name)
+run_cmake(CMP0148-Interp-NEW-path)
+run_cmake(CMP0148-Libs-OLD)
+run_cmake(CMP0148-Libs-WARN)
+run_cmake(CMP0148-Libs-NEW-name)
+run_cmake(CMP0148-Libs-NEW-path)