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.")