Merge pull request #3483 from akva2/backport_PR_3478

Backport #3478: Always search for Development component of Python.
This commit is contained in:
Arne Morten Kvarving 2023-04-24 08:47:30 +02:00 committed by GitHub
commit 95f62fbf58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,15 +216,15 @@ if (OPM_ENABLE_PYTHON)
if(PYTHON_EXECUTABLE AND NOT Python3_EXECUTABLE)
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
endif()
# We always need to search for Development as we use
# pybind11_add_module even if don't embed Python
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
if (OPM_ENABLE_EMBEDDED_PYTHON)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
get_target_property(_lib_path Python3::Python IMPORTED_LOCATION)
set(PYTHON_LIBRARY ${_lib_path})
set(PYTHON_LIBRARIES {PYTHON_LIBRARY})
list(APPEND opm-common_LIBRARIES ${PYTHON_LIBRARY})
set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter)
endif()
# Make sure we fail gracefully here without setuptool
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import setuptools"