From 15fc6c7003ca913f45720f55d8bd18a9d6d66297 Mon Sep 17 00:00:00 2001 From: selimnairb Date: Wed, 23 Aug 2023 15:43:57 -0400 Subject: [PATCH] CMake: update strategy for finding Python to allow building against a particular version --- api/swig/python/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/swig/python/CMakeLists.txt b/api/swig/python/CMakeLists.txt index aefd344f6d..3e8d3740f7 100644 --- a/api/swig/python/CMakeLists.txt +++ b/api/swig/python/CMakeLists.txt @@ -1,4 +1,11 @@ -find_package(Python3 COMPONENTS Interpreter Development REQUIRED) +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) +endif() + include_directories(../..) set_property(GLOBAL PROPERTY BAGPY_BINARY_DIR_PROP ${CMAKE_CURRENT_BINARY_DIR})