$OpenBSD: patch-Modules_FindPythonLibs_cmake,v 1.7 2012/11/11 17:13:31 dcoppa Exp $ --- Modules/FindPythonLibs.cmake.orig Fri Nov 2 10:56:12 2012 +++ Modules/FindPythonLibs.cmake Fri Nov 2 11:04:28 2012 @@ -36,6 +36,9 @@ 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(_PYTHON1_VERSIONS 1.6 1.5) set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0) @@ -69,10 +72,14 @@ endif() # 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} - ${_PYTHON_FIND_OTHER_VERSIONS} - ) +if(MODPY_VERSION) + set(_Python_VERSIONS ${MODPY_VERSION}) +else(MODPY_VERSION) + set(_Python_VERSIONS + ${Python_ADDITIONAL_VERSIONS} + ${_PYTHON_FIND_OTHER_VERSIONS} + ) +endif(MODPY_VERSION) unset(_PYTHON_FIND_OTHER_VERSIONS) unset(_PYTHON1_VERSIONS) @@ -129,18 +136,22 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) endforeach() endif() - find_path(PYTHON_INCLUDE_DIR - NAMES Python.h - PATHS - ${PYTHON_FRAMEWORK_INCLUDES} - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include - [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include - PATH_SUFFIXES - python${_CURRENT_VERSION}mu - python${_CURRENT_VERSION}m - python${_CURRENT_VERSION}u - 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 + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include + PATH_SUFFIXES + python${_CURRENT_VERSION}mu + python${_CURRENT_VERSION}m + python${_CURRENT_VERSION}u + python${_CURRENT_VERSION} + ) + endif(MODPY_VERSION AND MODPY_INCDIR) # For backward compatibility, set PYTHON_INCLUDE_PATH. set(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}")