CMake: default to Python 3.11, auto-update existing variables

This commit is contained in:
Campbell Barton
2023-12-23 00:23:24 +11:00
parent db8d381f71
commit 526019b559
2 changed files with 14 additions and 1 deletions

View File

@@ -36,7 +36,7 @@ else()
set(PYTHON_ROOT_DIR "")
endif()
set(_PYTHON_VERSION_SUPPORTED 3.10)
set(_PYTHON_VERSION_SUPPORTED 3.11)
set(PYTHON_VERSION ${_PYTHON_VERSION_SUPPORTED} CACHE STRING "Python Version (major and minor only)")
mark_as_advanced(PYTHON_VERSION)

View File

@@ -123,3 +123,16 @@ if(UNIX AND
message(STATUS "Auto updating CMake configuration for dynamic OpenShadingLanguage")
unset_cache_variables("^OSL_")
endif()
# Detect Python 3.10 to 3.11 upgrade for Blender 4.1.
if(UNIX AND
(NOT APPLE) AND
LIBDIR AND
EXISTS ${LIBDIR} AND
EXISTS ${LIBDIR}/python/bin/python3.11 AND
DEFINED PYTHON_VERSION AND
PYTHON_VERSION VERSION_LESS "3.11")
message(STATUS "Auto updating CMake configuration for Python 3.11")
unset_cache_variables("^PYTHON_")
endif()