From 05d5471ab2d5b7c2366fdfe94105afeb0cee0d9c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 6 Apr 2019 01:54:15 +0800 Subject: [PATCH] cmake: should PYTHON3_VERSION_STRING of libpython3 and make sure the version matches exactly the requested one in future, we should use FindPython.cmake Signed-off-by: Kefu Chai (cherry picked from commit 7b15b682b1201929e0ba9efc332ebb8652be40a8) --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fb32c9e42df7a..5f0218bf681c8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -220,7 +220,7 @@ endif() option(WITH_PYTHON2 "build python2 bindings" ON) if(WITH_PYTHON2) find_package(PythonInterp 2 REQUIRED) - find_package(PythonLibs 2 REQUIRED) + find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT REQUIRED) endif() set(WITH_PYTHON3 "OFF" CACHE STRING "build python3 bindings with specified python3 version") @@ -229,7 +229,7 @@ if(WITH_PYTHON3) set(WITH_PYTHON3 "3") endif() find_package(Python3Interp ${WITH_PYTHON3} REQUIRED) - find_package(Python3Libs ${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR} REQUIRED) + find_package(Python3Libs ${PYTHON3_VERSION_STRING} EXACT REQUIRED) endif() # the major version of the python bindings as a dependency of other -- 2.39.5