Skip to content

Commit

Permalink
cmake: make FindPython use system Python 3 version
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kdudka committed Dec 12, 2023
1 parent 56ceca8 commit 1c21b2f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1c21b2f

Please sign in to comment.