mirror of
https://gitdl.cn/https://github.com/chakralinux/desktop.git
synced 2025-01-24 02:22:13 +08:00
24 lines
1.0 KiB
Diff
24 lines
1.0 KiB
Diff
--- 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 ()
|