Merge pull request #3500 from akva2/backport_PR_3499

fixed: conditionally use Development.XXX in python find module
This commit is contained in:
Arne Morten Kvarving 2023-05-02 09:27:05 +02:00 committed by GitHub
commit 382c624f10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,9 +219,17 @@ if (OPM_ENABLE_PYTHON)
# We always need to search for Development as we use
# pybind11_add_module even if don't embed Python
if (NOT OPM_ENABLE_EMBEDDED_PYTHON)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
if(${CMAKE_VERSION} VERSION_LESS "3.18.0")
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
endif()
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Embed Development.Module)
if(${CMAKE_VERSION} VERSION_LESS "3.18.0")
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Embed Development.Module)
endif()
get_target_property(_lib_path Python3::Python IMPORTED_LOCATION)
set(PYTHON_LIBRARY ${_lib_path})
set(PYTHON_LIBRARIES {PYTHON_LIBRARY})