blob: 428f9e332678b17630f3201780780ab902419a73 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# Allow explicit Python path via environment variable
if(DEFINED ENV{PYTHON})
set(Python3_ROOT_DIR "$ENV{PYTHON}")
endif()
# On Windows, prefer registry entries to avoid Cygwin/MSYS Python
# The registry is searched first by default, which finds native Windows Python
# installations rather than Cygwin/MSYS Python
if(WINDOWS)
set(Python3_FIND_REGISTRY FIRST CACHE STRING "Python search order")
endif()
# Find Python 3 interpreter
find_package(Python3 REQUIRED COMPONENTS Interpreter)
# Set legacy variable name for compatibility with existing code
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}" CACHE FILEPATH "Python interpreter for builds")
mark_as_advanced(PYTHON_EXECUTABLE)
|