Skip to content

Commit dead908

Browse files
committed
cmake: Improve compatibility with Python version managers
1 parent ae69fc3 commit dead908

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,13 @@ if(WERROR)
534534
unset(werror_flag)
535535
endif()
536536

537+
# Prefer Unix-style package components over frameworks on macOS.
538+
# This improves compatibility with Python version managers.
539+
set(Python3_FIND_FRAMEWORK LAST CACHE STRING "")
540+
# Search for generic names before more specialized ones. This
541+
# improves compatibility with Python version managers that use shims.
542+
set(Python3_FIND_UNVERSIONED_NAMES FIRST CACHE STRING "")
543+
mark_as_advanced(Python3_FIND_FRAMEWORK Python3_FIND_UNVERSIONED_NAMES)
537544
find_package(Python3 3.10 COMPONENTS Interpreter)
538545
if(Python3_EXECUTABLE)
539546
set(PYTHON_COMMAND ${Python3_EXECUTABLE})

0 commit comments

Comments
 (0)