change to for both the debug and base library instead of just the debug
@@ -188,20 +188,34 @@ FOREACH(_CURRENT_VERSION 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
# against the detected filename.
GET_FILENAME_COMPONENT(PYLIB ${PYTHON_LIBRARY} NAME)
FOREACH(CV 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
- SET(curPYLIB "libpython${CV}.")
IF(WIN32)
STRING(REPLACE "." "" CV2 ${CV})
+ # Look for the debug verision if it is there.
if (CMAKE_BUILD_TYPE STREQUAL Debug)
SET(curPYLIB "python${CV2}_d.lib")
- else ()
- SET(curPYLIB "python${CV2}.lib")
+ IF(${PYLIB} MATCHES ${curPYLIB})
+ SET(PYTHON_VERSION ${CV})
+ MESSAGE(STATUS "Python version: ${PYTHON_VERSION}")
+ BREAK()
+ ENDIF(${PYLIB} MATCHES ${curPYLIB})
endif ()
- ENDIF(WIN32)
+
+ # Look for the base version.
+ SET(curPYLIB "python${CV2}.lib")
IF(${PYLIB} MATCHES ${curPYLIB})
SET(PYTHON_VERSION ${CV})
MESSAGE(STATUS "Python version: ${PYTHON_VERSION}")
BREAK()
ENDIF(${PYLIB} MATCHES ${curPYLIB})
+ ELSE(WIN32)
+ # Look for the base version.
+ SET(curPYLIB "libpython${CV}.")
+ IF(${PYLIB} MATCHES ${curPYLIB})
+ SET(PYTHON_VERSION ${CV})
+ MESSAGE(STATUS "Python version: ${PYTHON_VERSION}")
+ BREAK()
+ ENDIF(${PYLIB} MATCHES ${curPYLIB})
+ ENDIF(WIN32)
ENDFOREACH(CV)
BREAK()
ENDIF (PYTHON_LIBRARY AND PYTHON_INCLUDE_PATH)
