aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Wagner <david.wagner@intel.com>2015-04-14 18:13:11 +0200
committerEric Laurent <elaurent@google.com>2015-04-24 13:39:14 -0700
commit69c025eb4b42d203b0e6859d5c350cead91d4208 (patch)
tree4c30b1ad4a4d1338b1ecbd22172a80e01fb44a84
parent079608996beadb477b8d11777905cc8003b7af94 (diff)
downloadexternal_parameter-framework-69c025eb4b42d203b0e6859d5c350cead91d4208.zip
external_parameter-framework-69c025eb4b42d203b0e6859d5c350cead91d4208.tar.gz
external_parameter-framework-69c025eb4b42d203b0e6859d5c350cead91d4208.tar.bz2
python: prefer 2.7.x and make sure interpreter and libs are aligned
CMake's find_package command makes it possible to specify a version. Take advantage of that to favor the interpreter's version to 2.7 and then pin the library's version to the very same version as the interpreter. This does not ensure that 2.7.x is used (e.g. if 2.7.x is not present, another version will be used) but it helps a lot. Signed-off-by: David Wagner <david.wagner@intel.com>
-rw-r--r--bindings/python/CMakeLists.txt7
1 files changed, 5 insertions, 2 deletions
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index f3fc388..a885feb 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -29,7 +29,11 @@
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
-find_package(PythonLibs REQUIRED)
+# Force usage of Python 2.7.x ...
+find_package(PythonInterp 2.7 REQUIRED)
+
+# ... and force the libs to be at the same version as the interpreter
+find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/parameter/include)
@@ -63,7 +67,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable -DSWIG_PYTH
# plat_specific is needed because we are installing a shared-library python
# module and not only a pure python module.
# prefix='' makes get_python_lib return a relative path.
-find_package(PythonInterp)
execute_process(COMMAND
${PYTHON_EXECUTABLE} -c
"from distutils import sysconfig;\\