CMake: fix find_package(Python) when inactive pyenv Python installations are present

`find_package(Python)`'s default behavior is to attempt to use any `python3.x`
executables it finds before `python3`. This is problematic when using tools such
as pyenv, where `python3.x` executables may be present in a user's PATH but not
be functional.

Setting the `Python_FIND_UNVERSIONED_NAMES` hint to `FIRST` causes `python3` to
be attempted first, if it exists.

Note that this option was introduced in CMake 3.20:
https://cmake.org/cmake/help/latest/module/FindPython.html#hints
develop
lethosor 2023-05-09 21:56:07 -04:00
parent bfb6f3aa2e
commit e664f4aa7b
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 3 additions and 0 deletions

@ -376,6 +376,9 @@ endif()
#### expose depends ####
# fix for pyenv: default to `python3` before `python3.x`
set(Python_FIND_UNVERSIONED_NAMES FIRST)
if(UNIX)
# Rescan for pthread and zlib if the build arch changed
if(NOT "${DFHACK_BUILD_ARCH}" STREQUAL "${DFHACK_BUILD_ARCH_PREV}")