Skip to content

Commit

Permalink
[cmake] Compute PYTHONLIBS_VERSION_STRING only if patchlevel.h is found
Browse files Browse the repository at this point in the history
Fix the weird cmake message error when PYTHON_INCLUDE_DIR is not found
for the desired python version.
  • Loading branch information
Arnaud Degroote committed Mar 18, 2013
1 parent 8eac864 commit 545cdca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions config/FindPythonLibs.cmake
Expand Up @@ -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})
Expand Down

0 comments on commit 545cdca

Please sign in to comment.