Skip to content

Commit

Permalink
Fix CMakeLists BAGPY_INSTALL_PREFIX specification when not running fr…
Browse files Browse the repository at this point in the history
…om pip/setup.py
  • Loading branch information
selimnairb committed Aug 29, 2023
1 parent 345d5f1 commit 7fb515c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions api/swig/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ cmake_policy(SET CMP0078 NEW)
# Honor SWIG_MODULE_NAME via -module flag.
cmake_policy(SET CMP0086 NEW)

if(Python_LOOKUP_VERSION)
set(Python_FIND_STRATEGY VERSION)
find_package(Python ${Python_LOOKUP_VERSION} EXACT COMPONENTS Interpreter Development)
else()
set(Python_FIND_STRATEGY LOCATION)
find_package(Python3 COMPONENTS Interpreter Development)
set(Python_LIBRARIES Python3::Python)
endif()

# Handle where to install the resulting Python package
if (CALL_FROM_SETUP_PY)
# The CMakeExtension will set CMAKE_INSTALL_PREFIX to the root
Expand All @@ -14,15 +23,6 @@ else()
set(BAGPY_INSTALL_PREFIX ${Python3_SITELIB})
endif()

if(Python_LOOKUP_VERSION)
set(Python_FIND_STRATEGY VERSION)
find_package(Python ${Python_LOOKUP_VERSION} EXACT COMPONENTS Interpreter Development)
else()
set(Python_FIND_STRATEGY LOCATION)
find_package(Python3 COMPONENTS Interpreter Development)
set(Python_LIBRARIES Python3::Python)
endif()

if(DEFINED Python_INCLUDE_DIRS)
include_directories("${CMAKE_SOURCE_DIR}/api" "${Python_INCLUDE_DIRS}")
else()
Expand Down

0 comments on commit 7fb515c

Please sign in to comment.