From 490dbfa2e80b9415fe52ff0184c195af07ce1ec9 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:04:09 +0000 Subject: [PATCH] cmake: Improve compatibility with Python version managers --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b21646ca18..92822029476 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -534,6 +534,12 @@ if(WERROR) unset(werror_flag) endif() +# Prefer Unix-style package components over frameworks on macOS. +# This improves compatibility with Python version managers. +set(Python3_FIND_FRAMEWORK LAST CACHE STRING "") +# Search for generic names before more specialized ones. This +# improves compatibility with Python version managers that use shims. +set(Python3_FIND_UNVERSIONED_NAMES FIRST CACHE STRING "") find_package(Python3 3.10 COMPONENTS Interpreter) if(Python3_EXECUTABLE) set(PYTHON_COMMAND ${Python3_EXECUTABLE})