From 7876df25059c197e156747e544cd677240a7cb59 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 12 Dec 2023 22:05:09 +0100 Subject: [PATCH] cmake: make FindPython use system Python 3 version The newest installed version of Python 3 is often not the default version on a Gentoo Linux system, where multiple Python 3 versions can be installed on a single system and /usr/bin/python3 is the one that should be used by default. Related: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8287 Closes: https://github.com/csutils/csdiff/pull/153 --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 59cfac49..0e62c543 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -91,6 +91,10 @@ option(PYCSDIFF_PYTHON2 "Set to ON to build pycsdiff for Python 2" OFF) option(PYCSDIFF_PYTHON3 "Set to ON to build pycsdiff for Python 3" ON) macro(build_pycsdiff version) + # make FindPython use system Python 3 version + # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8287 + set(Python3_FIND_UNVERSIONED_NAMES FIRST) + # check for Python libs (e.g. python${version}-devel on Fedora) # Interpreter is required for Python_SITEARCH find_package(Python${version} COMPONENTS Development Interpreter)