summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-28 15:38:45 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-28 15:38:45 (GMT)
commit112ad2eb9733e144685ba9937c2f9c00f9d06220 (patch)
tree154f2375ae5422a7b80dfaf08446e1cc61a561c3
parentf1f3aa838e22facbee58dd54debdf62da524e7b7 (diff)
downloadlibkolabxml-112ad2eb9733e144685ba9937c2f9c00f9d06220.tar.gz
Only build Python bindings if Python can actually be found on the system (#659)
-rw-r--r--src/python/CMakeLists.txt36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index 7f0cdd1..ac5deed 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -15,25 +15,29 @@ ADD_CUSTOM_TARGET(generate_python_bindings ALL DEPENDS ${KOLAB_SWIG_PYTHON_SOURC
# Compile Python Bindings
find_package(PythonLibs)
-include_directories(${PYTHON_INCLUDE_DIRS})
-# python_add_module(kolabformat ${KOLAB_SWIG_PYTHON_SOURCE_FILE})
+if (PythonLibs_FOUND)
+ include_directories(${PYTHON_INCLUDE_DIRS})
-add_library(pythonbindings SHARED ${KOLAB_SWIG_PYTHON_SOURCE_FILE})
-target_link_libraries(pythonbindings kolabxml ${PYTHON_LIBRARY})
-SET_TARGET_PROPERTIES(pythonbindings PROPERTIES OUTPUT_NAME "_kolabformat")
-SET_TARGET_PROPERTIES(pythonbindings PROPERTIES PREFIX "")
+ # python_add_module(kolabformat ${KOLAB_SWIG_PYTHON_SOURCE_FILE})
-configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
+ add_library(pythonbindings SHARED ${KOLAB_SWIG_PYTHON_SOURCE_FILE})
+ target_link_libraries(pythonbindings kolabxml ${PYTHON_LIBRARY})
+ SET_TARGET_PROPERTIES(pythonbindings PROPERTIES OUTPUT_NAME "_kolabformat")
+ SET_TARGET_PROPERTIES(pythonbindings PROPERTIES PREFIX "")
-if (KOLAB_PYTHON_INSTALL_DIR)
- set(PYTHON_INSTALL_DIR ${KOLAB_PYTHON_INSTALL_DIR})
-else (KOLAB_PYTHON_INSTALL_DIR)
- set(PYTHON_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/pythonbindings)
-endif (KOLAB_PYTHON_INSTALL_DIR)
+ configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
-install(TARGETS pythonbindings LIBRARY DESTINATION ${PYTHON_INSTALL_DIR})
+ if (KOLAB_PYTHON_INSTALL_DIR)
+ set(PYTHON_INSTALL_DIR ${KOLAB_PYTHON_INSTALL_DIR})
+ else (KOLAB_PYTHON_INSTALL_DIR)
+ set(PYTHON_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/pythonbindings)
+ endif (KOLAB_PYTHON_INSTALL_DIR)
-install( FILES
- ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.py
- DESTINATION ${PYTHON_INSTALL_DIR}) \ No newline at end of file
+ install(TARGETS pythonbindings LIBRARY DESTINATION ${PYTHON_INSTALL_DIR})
+
+ install( FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.py
+ DESTINATION ${PYTHON_INSTALL_DIR}
+ )
+endif (PythonLibs_FOUND)