summaryrefslogtreecommitdiff
path: root/community/freeorion/cmake_python.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/freeorion/cmake_python.patch')
-rw-r--r--community/freeorion/cmake_python.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/community/freeorion/cmake_python.patch b/community/freeorion/cmake_python.patch
new file mode 100644
index 000000000..b875fa844
--- /dev/null
+++ b/community/freeorion/cmake_python.patch
@@ -0,0 +1,23 @@
+--- a/client/AI/CMakeLists.txt 2012-09-10 00:11:18.659341865 +0200
++++ b/client/AI/CMakeLists.txt 2012-09-10 00:12:37.659345189 +0200
+@@ -33,6 +33,20 @@
+ find_package(PythonLibs)
+ if (PYTHONLIBS_FOUND)
+ include_directories(${PYTHON_INCLUDE_PATH})
++ SET(_VERSION_REGEX
++ "^#define[ \t]+PY([A-Z_]*_VERSION)[ \t]+[\"]*([0-9A-Za-z\\.]+)[\"]*[ \t]*$")
++ FILE(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" _VERSION_STRINGS
++ LIMIT_COUNT 10 REGEX ${_VERSION_REGEX})
++ FOREACH(_VERSION_STRING ${_VERSION_STRINGS})
++ STRING(REGEX REPLACE ${_VERSION_REGEX} "PYTHON\\1"
++ _VERSION_VARIABLE "${_VERSION_STRING}")
++ STRING(REGEX REPLACE ${_VERSION_REGEX} "\\2"
++ _VERSION_NUMBER "${_VERSION_STRING}")
++ SET(${_VERSION_VARIABLE} ${_VERSION_NUMBER})
++ ENDFOREACH(_VERSION_STRING ${_VERSION_STRINGS})
++ IF(PYTHON_MAJOR_VERSION EQUAL 3)
++ MESSAGE(FATAL_ERROR "Python 3 is not supported!")
++ ENDIF()
+ else ()
+ message(FATAL_ERROR " library not found.")
+ endif ()