summaryrefslogtreecommitdiff
blob: c9ca1b2f9d0698cdc9647761a9c4b7aa48aa45d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/cmake/modules/FindBoostPython.cmake b/cmake/modules/FindBoostPython.cmake
index 2ccc161..02d9bf6 100644
--- a/cmake/modules/FindBoostPython.cmake
+++ b/cmake/modules/FindBoostPython.cmake
@@ -74,10 +74,10 @@ if(HAVE_BOOST_SHARED_PTR_HPP AND Boost_PYTHON_FOUND)
     # Second try: try pkg-config way
     find_package(PkgConfig)
     if(PKG_CONFIG_FOUND)
-      set(PYTHON_VERSIONS "python;python2.7;python2.6;python2.5;python2.4;python2.3;python2.2")
+      execute_process(COMMAND python -c "import sys; sys.stdout.write('.'.join(str(x) for x in sys.version_info[:2]))" OUTPUT_VARIABLE PYTHON_VERSIONS)
       foreach(_pyver ${PYTHON_VERSIONS})
         if(NOT BoostPython_INCLUDES OR NOT BoostPython_LIBS)
-          pkg_check_modules(${_pyver} QUIET ${_pyver})
+         pkg_check_modules(_python python-${_pyver})
           if(${_pyver}_FOUND)
             cmake_push_check_state()
             set(CMAKE_REQUIRED_INCLUDES  ${CMAKE_REQUIRED_INCLUDES}  ${${_pyver}_INCLUDE_DIRS})