CMake 3.16 compatibility

This commit is contained in:
Matthias Hochsteger 2023-08-30 21:03:04 +02:00
parent 80098c1e93
commit c8888086ae
2 changed files with 4 additions and 3 deletions

View File

@ -87,6 +87,7 @@ set(NG_INSTALL_SUFFIX netgen CACHE STRING "Suffix appended to install directorie
if(USE_PYTHON) if(USE_PYTHON)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18) if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
find_package(Python3 COMPONENTS Interpreter Development.Embed)
else() else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development) find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
endif() endif()
@ -319,8 +320,7 @@ if (USE_PYTHON)
target_include_directories(netgen_python INTERFACE ${pybind11_INCLUDE_DIR} ${Python3_INCLUDE_DIRS}) target_include_directories(netgen_python INTERFACE ${pybind11_INCLUDE_DIR} ${Python3_INCLUDE_DIRS})
target_include_directories(nglib PRIVATE ${pybind11_INCLUDE_DIR} ${Python3_INCLUDE_DIRS}) target_include_directories(nglib PRIVATE ${pybind11_INCLUDE_DIR} ${Python3_INCLUDE_DIRS})
if(NOT ${BUILD_FOR_CONDA} OR WIN32) if(Python3_LIBRARIES)
# Don't link python libraries in conda environments
target_link_libraries(netgen_python INTERFACE ${Python3_LIBRARIES}) target_link_libraries(netgen_python INTERFACE ${Python3_LIBRARIES})
endif() endif()

View File

@ -183,6 +183,7 @@ if (USE_PYTHON)
endif( PYBIND_INCLUDE_DIR ) endif( PYBIND_INCLUDE_DIR )
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18) if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
find_package(Python3 COMPONENTS Interpreter Development.Embed)
else() else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development) find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
endif() endif()