Skip to content

Commit 4be9abe

Browse files
committed
Fix issue with CMake versions prior to 3.18
Ported from a pybind11 PR by @henryiii: pybind/pybind11#4805
1 parent 5f1cbae commit 4be9abe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ endif()
5757
if (NOT TARGET Python::Module OR NOT TARGET Python::Interpreter)
5858
set(Python_FIND_FRAMEWORK LAST) # Prefer Brew/Conda to Apple framework python
5959

60+
if (CMAKE_VERSION VERSION_LESS 3.18)
61+
set(NB_PYTHON_DEV_MODULE Development)
62+
else()
63+
set(NB_PYTHON_DEV_MODULE Development.Module)
64+
endif()
65+
6066
find_package(Python 3.8
61-
REQUIRED COMPONENTS Interpreter Development.Module
67+
REQUIRED COMPONENTS Interpreter ${NB_PYTHON_DEV_MODULE}
6268
OPTIONAL_COMPONENTS Development.SABIModule)
6369
endif()
6470

0 commit comments

Comments
 (0)