$OpenBSD: patch-Modules_FindPythonLibs_cmake,v 1.3 2011/03/13 18:23:02 dcoppa Exp $ --- Modules/FindPythonLibs.cmake.orig Tue Feb 15 18:47:27 2011 +++ Modules/FindPythonLibs.cmake Mon Mar 7 11:42:19 2011 @@ -27,11 +27,18 @@ INCLUDE(CMakeFindFrameworks) # Search for the python framework on Apple. CMAKE_FIND_FRAMEWORKS(Python) +SET(MODPY_VERSION $ENV{MODPY_VERSION}) +SET(MODPY_INCDIR $ENV{MODPY_INCDIR}) + # Set up the versions we know about, in the order we will search. Always add # the user supplied additional versions to the front. -set(_Python_VERSIONS - ${Python_ADDITIONAL_VERSIONS} - 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) +IF(MODPY_VERSION) + set(_Python_VERSIONS ${MODPY_VERSION}) +ELSE(MODPY_VERSION) + set(_Python_VERSIONS + ${Python_ADDITIONAL_VERSIONS} + 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) +ENDIF(MODPY_VERSION) FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) @@ -74,14 +81,18 @@ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) ENDFOREACH(dir) ENDIF(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR) - FIND_PATH(PYTHON_INCLUDE_DIR - NAMES Python.h - PATHS - ${PYTHON_FRAMEWORK_INCLUDES} - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include - PATH_SUFFIXES - python${_CURRENT_VERSION} - ) + IF(MODPY_VERSION AND MODPY_INCDIR) + SET(PYTHON_INCLUDE_DIR "${MODPY_INCDIR}") + ELSE(MODPY_VERSION AND MODPY_INCDIR) + FIND_PATH(PYTHON_INCLUDE_DIR + NAMES Python.h + PATHS + ${PYTHON_FRAMEWORK_INCLUDES} + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include + PATH_SUFFIXES + python${_CURRENT_VERSION} + ) + ENDIF(MODPY_VERSION AND MODPY_INCDIR) # For backward compatibility, set PYTHON_INCLUDE_PATH, but make it internal. SET(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}" CACHE INTERNAL