From 26711b12321ebc6b4e3f78715da8501ad16a6933 Mon Sep 17 00:00:00 2001 From: Roland Kaminski Date: Thu, 15 Feb 2024 18:31:55 +0100 Subject: [PATCH] better finding of python extensions --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6656681..71d40aa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,7 @@ if (NOT CMAKE_IMPORT_LIBRARY_PREFIX) set(CMAKE_IMPORT_LIBRARY_PREFIX import_) endif() +add_subdirectory(third_party) if (PYCLINGODL_ENABLE) if(NOT PYCLINGODL_ENABLE STREQUAL "pip" AND (CMAKE_VERSION VERSION_GREATER "3.15.0" OR CMAKE_VERSION VERSION_EQUAL "3.15.0")) @@ -116,9 +117,14 @@ if (PYCLINGODL_ENABLE) if (PYCLINGODL_ENABLE STREQUAL "require" OR PYCLINGODL_ENABLE STREQUAL "pip") set(_args ${_args} REQUIRED) endif() - find_package(PythonInterp ${_args}) - find_package(PythonLibs ${_args}) + if (PYCLINGODL_ENABLE STREQUAL "pip") + find_package(PythonExtensions ${_args}) + else() + find_package(PythonInterp ${_args}) + find_package(PythonLibs ${_args}) + endif() set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}") + set(Python_VERSION_MAJOR "${PYTHON_VERSION_MAJOR}") if (PYTHONLIBS_FOUND) add_library(Python::Python INTERFACE IMPORTED) add_library(Python::Module INTERFACE IMPORTED) @@ -135,7 +141,6 @@ if (PYCLINGODL_ENABLE) endif() endif() -add_subdirectory(third_party) if (PYCLINGODL_ENABLE STREQUAL "pip") if (NOT CLINGODL_BUILD_SHARED) message(FATAL_ERROR "building against the pip package requires CLINGODL_BUILD_SHARED.")