Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
4fb111bd
Unverified
Commit
4fb111bd
authored
Sep 15, 2023
by
Henry Schreiner
Committed by
GitHub
Sep 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(cmake): correctly detect FindPython policy and better warning (#4806)
parent
d06d5369
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
CMakeLists.txt
+10
-0
tools/FindPythonLibsNew.cmake
+16
-0
No files found.
CMakeLists.txt
View file @
4fb111bd
...
@@ -5,6 +5,11 @@
...
@@ -5,6 +5,11 @@
# All rights reserved. Use of this source code is governed by a
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# BSD-style license that can be found in the LICENSE file.
# Propagate this policy (FindPythonInterp removal) so it can be detected later
if
(
NOT CMAKE_VERSION VERSION_LESS
"3.27"
)
cmake_policy
(
GET CMP0148 _pybind11_cmp0148
)
endif
()
cmake_minimum_required
(
VERSION 3.5
)
cmake_minimum_required
(
VERSION 3.5
)
# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
...
@@ -16,6 +21,11 @@ else()
...
@@ -16,6 +21,11 @@ else()
cmake_policy
(
VERSION 3.26
)
cmake_policy
(
VERSION 3.26
)
endif
()
endif
()
if
(
_pybind11_cmp0148
)
cmake_policy
(
SET CMP0148
${
_pybind11_cmp0148
}
)
unset
(
_pybind11_cmp0148
)
endif
()
# Avoid infinite recursion if tests include this as a subdirectory
# Avoid infinite recursion if tests include this as a subdirectory
if
(
DEFINED PYBIND11_MASTER_PROJECT
)
if
(
DEFINED PYBIND11_MASTER_PROJECT
)
return
()
return
()
...
...
tools/FindPythonLibsNew.cmake
View file @
4fb111bd
...
@@ -95,6 +95,22 @@ if(NOT PythonLibsNew_FIND_VERSION)
...
@@ -95,6 +95,22 @@ if(NOT PythonLibsNew_FIND_VERSION)
set
(
PythonLibsNew_FIND_VERSION
"3.6"
)
set
(
PythonLibsNew_FIND_VERSION
"3.6"
)
endif
()
endif
()
if
(
NOT CMAKE_VERSION VERSION_LESS
"3.27"
)
cmake_policy
(
GET CMP0148 _pybind11_cmp0148
)
if
(
NOT _pybind11_cmp0148
)
message
(
AUTHOR_WARNING
"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, or preferably upgrade to using FindPython, either by "
"calling it explicitly before pybind11, or by setting "
"PYBIND11_FINDPYTHON ON before pybind11."
)
endif
()
cmake_policy
(
SET CMP0148 OLD
)
unset
(
_pybind11_cmp0148
)
endif
()
find_package
(
PythonInterp
${
PythonLibsNew_FIND_VERSION
}
${
_pythonlibs_required
}
find_package
(
PythonInterp
${
PythonLibsNew_FIND_VERSION
}
${
_pythonlibs_required
}
${
_pythonlibs_quiet
}
)
${
_pythonlibs_quiet
}
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment