diff --git a/cmake/PybindModuleCreation.cmake b/cmake/PybindModuleCreation.cmake index 8030c1a8639e4b7ae0c5fb865e928a4260c6ae7d..4e03a71ee5c605cc902e1b9e568534ca17230b5b 100644 --- a/cmake/PybindModuleCreation.cmake +++ b/cmake/PybindModuleCreation.cmake @@ -9,7 +9,9 @@ function(generate_python_binding name target_to_bind) ) # Use the New FindPython mode, recommanded. Requires CMake 3.15+ - find_package(Python COMPONENTS Interpreter Development) + if ( NOT DEFINED PYTHON_EXECUTABLE OR NOT DEFINED PYTHON_INCLUDE_DIR OR NOT DEFINED PYTHON_LIBRARY ) + find_package(Python 3.7 COMPONENTS Interpreter Development.Module REQUIRED) + endif() FetchContent_MakeAvailable(PyBind11) message(STATUS "Creating binding for module ${name}")