Use Python Library version of the found Python Interpreter

If you have python2 at /usr/bin/python , but also
have python3 libraries and header files installed,
CMake will use the python2 interpreter, but the
python3 libraries. This causes the python libraries
found to have the same major and minor version as
the interpreter.
This commit is contained in:
David Hall
2013-10-21 18:33:20 -04:00
parent 4f6984e55f
commit 2ae9cccc76
+9 -5
View File
@@ -38,16 +38,20 @@ endif()
if (PYTHON_BINDINGS)
if (EXISTS ${openbabel_SOURCE_DIR}/scripts/python/openbabel-python.cpp OR RUN_SWIG)
find_package(PythonLibs)
if (NOT PYTHONLIBS_FOUND)
message(STATUS "Python libraries NOT found")
endif (NOT PYTHONLIBS_FOUND)
find_package(PythonInterp)
if (NOT PYTHONINTERP_FOUND)
message(STATUS "Python interpreter NOT found")
endif (NOT PYTHONINTERP_FOUND)
if (PYTHONINTERP_FOUND AND NOT Python_ADDITIONAL_VERSIONS)
set(Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
endif (PYTHONINTERP_FOUND AND NOT Python_ADDITIONAL_VERSIONS)
find_package(PythonLibs)
if (NOT PYTHONLIBS_FOUND)
message(STATUS "Python libraries NOT found")
endif (NOT PYTHONLIBS_FOUND)
if(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
set(DO_PYTHON_BINDINGS ON BOOL)
message(STATUS "Python bindings will be compiled")