cmake 3.19.4 changes to find Python 3 libraries and include files

When compiling on Mac Big Sur the previous (deprecated) find_package fails to find Python3 Libraries and Include files
This commit is contained in:
Jake Turner
2021-02-13 16:34:26 +00:00
committed by Baldur Karlsson
parent 329b092cfb
commit 423ca67fb2
+9 -2
View File
@@ -391,8 +391,15 @@ add_subdirectory(renderdoc)
if(ENABLE_QRENDERDOC OR ENABLE_PYRENDERDOC)
# Make sure Python 3 is found
set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6 3.5 3.4)
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.12")
find_package(Python COMPONENTS Interpreter Development)
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
set(PYTHON_LIBRARY ${Python_LIBRARIES})
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
else()
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
endif()
# we also need python3-config for swig
if(NOT EXISTS "${PYTHON_EXECUTABLE}-config" AND NOT EXISTS "${PYTHON_EXECUTABLE}.${PYTHON_VERSION_MINOR}-config")
message(FATAL_ERROR "We require ${PYTHON_EXECUTABLE}-config or ${PYTHON_EXECUTABLE}.${PYTHON_VERSION_MINOR}-config to build swig, please install the python dev package for your system.")