Skip to content

Commit

Permalink
better finding of python extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
rkaminsk committed Feb 15, 2024
1 parent 0375aa6 commit 26711b1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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)
Expand All @@ -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.")
Expand Down

0 comments on commit 26711b1

Please sign in to comment.