d013c2ba21
Add FindLibLZMA module (upstream git commit ee26019bd433020b8aad3c3a70bcb537e03b04ba) Bugfix: FindPythonLibs: honor EXACT version specification (upstream git commit 9d145b0998f21ae6d0571c5b6a7ab0168722df7c) Bugfix: UseJava: fix find_jar() called with multiple files (upstream git commit 5593d5718ec90f6a2e37ca4e2fdf3fc4537380ff)
90 lines
3.8 KiB
Plaintext
90 lines
3.8 KiB
Plaintext
$OpenBSD: patch-Modules_FindPythonLibs_cmake,v 1.5 2012/06/15 10:26:56 dcoppa Exp $
|
|
|
|
From 9d145b0998f21ae6d0571c5b6a7ab0168722df7c Mon Sep 17 00:00:00 2001
|
|
From: Rolf Eike Beer <eike@sf-mail.de>
|
|
Date: Tue, 5 Jun 2012 20:02:58 +0200
|
|
Subject: [PATCH] FindPythonLibs: honor EXACT version specification (#13216)
|
|
|
|
--- Modules/FindPythonLibs.cmake.orig Fri Jun 15 11:41:23 2012
|
|
+++ Modules/FindPythonLibs.cmake Fri Jun 15 11:41:31 2012
|
|
@@ -31,6 +31,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)
|
|
@@ -40,13 +43,19 @@ IF(PythonLibs_FIND_VERSION)
|
|
STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}")
|
|
STRING(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
|
|
UNSET(_PYTHON_FIND_OTHER_VERSIONS)
|
|
- IF(NOT PythonLibs_FIND_VERSION_EXACT)
|
|
+ IF(PythonLibs_FIND_VERSION_EXACT)
|
|
+ IF(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
|
|
+ SET(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}")
|
|
+ ELSE(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
|
|
+ SET(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}")
|
|
+ ENDIF(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
|
|
+ ELSE(PythonLibs_FIND_VERSION_EXACT)
|
|
FOREACH(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
|
|
IF(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
|
LIST(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
|
ENDIF()
|
|
ENDFOREACH()
|
|
- ENDIF(NOT PythonLibs_FIND_VERSION_EXACT)
|
|
+ ENDIF(PythonLibs_FIND_VERSION_EXACT)
|
|
UNSET(_PYTHON_FIND_MAJ_MIN)
|
|
UNSET(_PYTHON_FIND_MAJ)
|
|
ELSE(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
|
@@ -58,10 +67,14 @@ ENDIF(PythonLibs_FIND_VERSION)
|
|
|
|
# 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)
|
|
@@ -113,15 +126,19 @@ 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
|
|
- [HKEY_CURRENT_USER\\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
|
|
+ [HKEY_CURRENT_USER\\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
|