Patch cmake to allow detection of python 2.7.9+
authorAidan Dodds <aidan@codeplay.com>
Thu, 17 Dec 2015 14:13:39 +0000 (14:13 +0000)
committerAidan Dodds <aidan@codeplay.com>
Thu, 17 Dec 2015 14:13:39 +0000 (14:13 +0000)
Some distributions of python have their version defined as follows in patchlevel.h (note the '+'):
#define PY_VERSION "2.7.9+"
The '+' char needs to be stripped by the cmake regex so that LLDBs python lib detection is successful.

Differential Revision: http://reviews.llvm.org/D15566

llvm-svn: 255893

lldb/cmake/modules/LLDBConfig.cmake

index e0aaf4de044338b141338482d545cd4399b1098e..f5247a269822416065c0fd02d4e74096e00a60d2 100644 (file)
@@ -71,8 +71,8 @@ function(find_python_libs_windows)
   if(EXISTS "${PYTHON_INCLUDE_DIRS}/patchlevel.h")
     file(STRINGS "${PYTHON_INCLUDE_DIRS}/patchlevel.h" python_version_str
          REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"")
-    string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1"
-                         PYTHONLIBS_VERSION_STRING "${python_version_str}")
+    string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"+]+)[+]?\".*" "\\1"
+         PYTHONLIBS_VERSION_STRING "${python_version_str}")
     message("-- Found Python version ${PYTHONLIBS_VERSION_STRING}")
     string(REGEX REPLACE "([0-9]+)[.]([0-9]+)[.][0-9]+" "python\\1\\2" PYTHONLIBS_BASE_NAME "${PYTHONLIBS_VERSION_STRING}")
     unset(python_version_str)