Prefer custom python interpreter set via -DPython_EXECUTABLE if possible

This commit is contained in:
Axel Kohlmeyer
2023-05-10 18:48:47 -04:00
parent 7c4883704c
commit 4c65aa572d
2 changed files with 12 additions and 4 deletions

View File

@ -5,6 +5,10 @@ if(CMAKE_VERSION VERSION_LESS 3.12)
set(Python3_VERSION ${PYTHON_VERSION_STRING})
endif()
else()
# use default (or custom) Python executable, if version is sufficient
if(Python_VERSION VERSION_GREATER_EQUAL 3.5)
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
endif()
find_package(Python3 COMPONENTS Interpreter QUIET)
endif()