Skip to content

Commit fb79bc8

Browse files
committed
Merge branch 'master' into sh_merge_master
2 parents 55105fb + 76b7f53 commit fb79bc8

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

tools/pybind11NewTools.cmake

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,22 @@ if(NOT Python_FOUND AND NOT Python3_FOUND)
3232
set(Python_ROOT_DIR "$ENV{pythonLocation}")
3333
endif()
3434

35-
find_package(Python 3.6 REQUIRED COMPONENTS Interpreter Development ${_pybind11_quiet})
35+
# Development.Module support (required for manylinux) started in 3.18
36+
if(CMAKE_VERSION VERSION_LESS 3.18)
37+
set(_pybind11_dev_component Development)
38+
else()
39+
set(_pybind11_dev_component Development.Module OPTIONAL_COMPONENTS Development.Embed)
40+
endif()
41+
42+
find_package(Python 3.6 REQUIRED COMPONENTS Interpreter ${_pybind11_dev_component}
43+
${_pybind11_quiet})
3644

3745
# If we are in submodule mode, export the Python targets to global targets.
3846
# If this behavior is not desired, FindPython _before_ pybind11.
3947
if(NOT is_config)
40-
set_property(TARGET Python::Python PROPERTY IMPORTED_GLOBAL TRUE)
48+
if(TARGET Python::Python)
49+
set_property(TARGET Python::Python PROPERTY IMPORTED_GLOBAL TRUE)
50+
endif()
4151
set_property(TARGET Python::Interpreter PROPERTY IMPORTED_GLOBAL TRUE)
4252
if(TARGET Python::Module)
4353
set_property(TARGET Python::Module PROPERTY IMPORTED_GLOBAL TRUE)

tools/pybind11Tools.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ endif()
4343

4444
# A user can set versions manually too
4545
set(Python_ADDITIONAL_VERSIONS
46-
"3.11;3.10;3.9;3.8;3.7;3.6"
46+
"3.12;3.11;3.10;3.9;3.8;3.7;3.6"
4747
CACHE INTERNAL "")
4848

4949
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

0 commit comments

Comments
 (0)