summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2017-11-10 15:06:22 +0100
committerSander Vrijders <[email protected]>2017-11-10 15:30:51 +0100
commit3b276deb9b52ba8c667c12379c39dc46ea375609 (patch)
tree11ef52a9468c5ff408b64003931d56843a5d182a /include
parenta1127d54b52d76f0bb5e79d5fc973a2c41a8200d (diff)
downloadouroboros-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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/wrap/CMakeLists.txt9
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