diff options
author | Dimitri Staessens <dimitri.staessens@ugent.be> | 2017-11-10 15:06:22 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-11-10 15:30:51 +0100 |
commit | 3b276deb9b52ba8c667c12379c39dc46ea375609 (patch) | |
tree | 11ef52a9468c5ff408b64003931d56843a5d182a /include | |
parent | a1127d54b52d76f0bb5e79d5fc973a2c41a8200d (diff) | |
download | ouroboros-3b276deb9b52ba8c667c12379c39dc46ea375609.tar.gz ouroboros-3b276deb9b52ba8c667c12379c39dc46ea375609.zip |
build: Fix detection of python for swig bindings
The cmake build only looked for the libraries but not the interpreter,
which caused the build to fail if the library was present, but the
interpreter was not installed and executable using the "python"
command. The build now looks for the python interpreter as well.
Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/wrap/CMakeLists.txt | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/ouroboros/wrap/CMakeLists.txt b/include/ouroboros/wrap/CMakeLists.txt index 4ffc54a8..43ebd242 100644 --- a/include/ouroboros/wrap/CMakeLists.txt +++ b/include/ouroboros/wrap/CMakeLists.txt @@ -10,8 +10,9 @@ else () include_directories(${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_SWIG_FLAGS "") + find_package(PythonInterp QUIET) find_package(PythonLibs QUIET) - if (NOT PYTHONLIBS_FOUND) + if (NOT PYTHONLIBS_FOUND OR NOT PYTHONINTERP_FOUND) message(STATUS "Python not found: Python bindings will not be built") else () message(STATUS "Python found: Python bindings will be built") @@ -38,12 +39,14 @@ else () # Installation directives if (CMAKE_INSTALL_PREFIX STREQUAL "") execute_process( - COMMAND python -c "from distutils import sysconfig; print(sysconfig.get_python_lib())" + COMMAND ${PYTHON_EXECUTABLE} -c + "from distutils import sysconfig; print(sysconfig.get_python_lib())" OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) else () execute_process( - COMMAND python -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))" + COMMAND ${PYTHON_EXECUTABLE} -c + "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))" OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) get_filename_component(_ABS_PYTHON_MODULE_PATH |