From 80098c1e934a9f78e1251663460bbe59b0044d45 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 30 Aug 2023 20:25:11 +0200 Subject: [PATCH] Set parameters to FindPython3 depending on CMake version --- CMakeLists.txt | 6 +++++- cmake/SuperBuild.cmake | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60dac490..19af1133 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,11 @@ endif() set(NG_INSTALL_SUFFIX netgen CACHE STRING "Suffix appended to install directories (project name)") if(USE_PYTHON) - find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) + if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18) + find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) + else() + find_package(Python3 REQUIRED COMPONENTS Interpreter Development) + endif() execute_process(COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) file(TO_CMAKE_PATH ${PYTHON_PACKAGES_INSTALL_DIR} PYTHON_PACKAGES_INSTALL_DIR) diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index d7de225c..2ebd3cd6 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -181,7 +181,11 @@ if (USE_PYTHON) else( PYBIND_INCLUDE_DIR ) message(FATAL_ERROR "Could NOT find pybind11!") endif( PYBIND_INCLUDE_DIR ) - find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) + if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18) + find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) + else() + find_package(Python3 REQUIRED COMPONENTS Interpreter Development) + endif() set_vars(NETGEN_CMAKE_ARGS Python3_INCLUDE_DIRS