Permalink
Browse files

[cmake] Compute PYTHONLIBS_VERSION_STRING only if patchlevel.h is found

Fix the weird cmake message error when PYTHON_INCLUDE_DIR is not found
for the desired python version.
  • Loading branch information...
1 parent 8eac864 commit 545cdca2f6f8b04b338c5576ea85954808736931 @adegroote adegroote committed Mar 18, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 config/FindPythonLibs.cmake
@@ -186,10 +186,11 @@ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS})
STRING(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1"
_PYTHONLIBS_VERSION_STRING "${python_version_str}")
UNSET(python_version_str)
+
+ # erase minor version
+ STRING(SUBSTRING ${_PYTHONLIBS_VERSION_STRING} 0 3 PYTHONLIBS_VERSION_STRING)
ENDIF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h")
- # erase minor version
- STRING(SUBSTRING ${_PYTHONLIBS_VERSION_STRING} 0 3 PYTHONLIBS_VERSION_STRING)
IF (NOT ("${PYTHON_INCLUDE_DIR}" STREQUAL "${PYTHON_INCLUDE_DIR2}"))
set(PYTHON_INCLUDE_DIR_TMP ${PYTHON_INCLUDE_DIR})

0 comments on commit 545cdca

Please sign in to comment.