From 7fb515c1a919656a0f843bcb9b1c4b69ea6dd130 Mon Sep 17 00:00:00 2001 From: selimnairb Date: Tue, 29 Aug 2023 15:02:38 -0400 Subject: [PATCH] Fix CMakeLists BAGPY_INSTALL_PREFIX specification when not running from pip/setup.py --- api/swig/python/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/api/swig/python/CMakeLists.txt b/api/swig/python/CMakeLists.txt index ee67515655..d72241c508 100644 --- a/api/swig/python/CMakeLists.txt +++ b/api/swig/python/CMakeLists.txt @@ -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 @@ -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()