File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 5
5
# All rights reserved. Use of this source code is governed by a
6
6
# BSD-style license that can be found in the LICENSE file.
7
7
8
+ # Propagate this policy (FindPythonInterp removal) so it can be detected later
9
+ if (NOT CMAKE_VERSION VERSION_LESS "3.27" )
10
+ cmake_policy (GET CMP0148 _pybind11_cmp0148)
11
+ endif ()
12
+
8
13
cmake_minimum_required (VERSION 3.5)
9
14
10
15
# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
@@ -16,6 +21,11 @@ else()
16
21
cmake_policy (VERSION 3.26)
17
22
endif ()
18
23
24
+ if (_pybind11_cmp0148)
25
+ cmake_policy (SET CMP0148 ${_pybind11_cmp0148} )
26
+ unset (_pybind11_cmp0148)
27
+ endif ()
28
+
19
29
# Avoid infinite recursion if tests include this as a subdirectory
20
30
if (DEFINED PYBIND11_MASTER_PROJECT)
21
31
return ()
Original file line number Diff line number Diff line change @@ -95,6 +95,22 @@ if(NOT PythonLibsNew_FIND_VERSION)
95
95
set (PythonLibsNew_FIND_VERSION "3.6" )
96
96
endif ()
97
97
98
+ if (NOT CMAKE_VERSION VERSION_LESS "3.27" )
99
+ cmake_policy (GET CMP0148 _pybind11_cmp0148)
100
+ if (NOT _pybind11_cmp0148)
101
+ message (
102
+ AUTHOR_WARNING
103
+ "Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs "
104
+ "modules are removed. Run \" cmake --help-policy CMP0148\" for policy "
105
+ "details. Use the cmake_policy command to set the policy and suppress "
106
+ "this warning, or preferably upgrade to using FindPython, either by "
107
+ "calling it explicitly before pybind11, or by setting "
108
+ "PYBIND11_FINDPYTHON ON before pybind11." )
109
+ endif ()
110
+ cmake_policy (SET CMP0148 OLD)
111
+ unset (_pybind11_cmp0148)
112
+ endif ()
113
+
98
114
find_package (PythonInterp ${PythonLibsNew_FIND_VERSION} ${_pythonlibs_required}
99
115
${_pythonlibs_quiet} )
100
116
You can’t perform that action at this time.
0 commit comments