Force exact interpreter version found by find_package(PythonLibs)

The call to `find_package(PythonLibs REQUIRED)` will set
the `PYTHONLIBS_VERSION_STRING` variable (see the documentation
at https://cmake.org/cmake/help/v3.0/module/FindPythonLibs.html)

Use that value of the version for the call to `find_package(PythonInterp)`
with `EXACT` flag added to enforce consistency between the Python
interpreter, the linked Python library and the Python header.

See !65.
This commit is contained in:
Nicolas Bigaouette 2016-01-12 13:48:33 -05:00
parent 8bd1f49de7
commit 272e9e19fc

View File

@ -26,7 +26,7 @@ string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6) set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6)
find_package(PythonLibs REQUIRED) find_package(PythonLibs REQUIRED)
find_package(PythonInterp REQUIRED) find_package(PythonInterp ${PYTHONLIBS_VERSION_STRING} EXACT REQUIRED)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)