summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2012-04-19 16:10:34 (GMT)
committerChristian Mollekopf <chrigi_1@fastmail.fm>2012-04-19 16:10:34 (GMT)
commitc0a2200245e2265f0b6848b764497c613f47eb9a (patch)
tree33ec462f2910ea4509ed3a6ba4a62e3b3fff2173
parent0eb815b60aa5155ccf3c8baa94b67e3e209d16dc (diff)
downloadlibkolabxml-c0a2200245e2265f0b6848b764497c613f47eb9a.tar.gz
For some reason that is beyond me python is not found on el6, this allows to override this and adds a fallback search mechanism.
-rw-r--r--src/python/CMakeLists.txt32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index 4ef88db..042ed41 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -2,10 +2,42 @@
include_directories(../)
# Compile Python Bindings
+
+#always run this for the macros
find_package(PythonLibs)
+#Allow to override automatic finding
+if (PYTHON_LIBRARY_OVERRIDE AND PYTHON_INCLUDE_DIR_OVERRIDE)
+ message("python library specified manually")
+ SET(PYTHON_LIBRARY ${PYTHON_LIBRARY_OVERRIDE})
+ SET(PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR_OVERRIDE})
+ SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY_OVERRIDE})
+ SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR_OVERRIDE})
+ SET(PYTHONLIBS_FOUND TRUE)
+else()
+ if (NOT PYTHONLIBS_FOUND)
+ message("trying to find python manually")
+ set(_Python_VERSIONS 2.7 2.6 )
+ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS})
+ STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION})
+ find_library(PYTHON_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION} HINTS ${FIND_LIBRARY_PATHS})
+ if (PYTHON_LIBRARIES)
+ FIND_PATH(PYTHON_INCLUDE_DIR
+ NAMES Python.h
+ PATH_SUFFIXES
+ python${_CURRENT_VERSION}
+ )
+ SET(PYTHONLIBS_FOUND TRUE)
+ SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY_OVERRIDE})
+ SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR_OVERRIDE})
+ endif()
+ ENDFOREACH(_CURRENT_VERSION)
+ endif()
+endif()
+
if (NOT PYTHONLIBS_FOUND)
message("python libs not found, not building python bindings")
+ message("you can specify PYTHON_LIBRARY_OVERRIDE and PYTHON_INCLUDE_DIR_OVERRIDE manually")
return()
endif()