[Cmake-commits] CMake branch, next, updated. v3.3.1-3050-g1373120
Brad King
brad.king at kitware.com
Thu Sep 17 11:31:33 EDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 13731202f402f6e9d8227560fcc1278f483b530b (commit)
via f8bc4e1118d133a45974a56239cfe768785ca09f (commit)
via a9d32dffb9397ce98806176f759fea4e77acf076 (commit)
from d89405d63c1ab165e84799d00635ecf3294fb400 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13731202f402f6e9d8227560fcc1278f483b530b
commit 13731202f402f6e9d8227560fcc1278f483b530b
Merge: d89405d f8bc4e1
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 17 11:31:32 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Sep 17 11:31:32 2015 -0400
Merge topic 'FindPython-updates' into next
f8bc4e11 FindPythonLibs: Use python executable prefix as a hint
a9d32dff FindPythonLibs: Match include dir to library version
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f8bc4e1118d133a45974a56239cfe768785ca09f
commit f8bc4e1118d133a45974a56239cfe768785ca09f
Author: David Gobbi <david.gobbi at gmail.com>
AuthorDate: Thu Sep 17 08:22:27 2015 -0600
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Sep 17 11:30:18 2015 -0400
FindPythonLibs: Use python executable prefix as a hint
If PYTHON_EXECUTABLE is set, then we should look for the libs in the
same prefix, e.g. /usr/local/python -> /usr/local/lib, and on Win32
/Python34/python.exe -> /Python34/libs.
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 1220860..91cf49b 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -49,6 +49,23 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+# Use the executable's path as a hint
+set(_Python_LIBRARY_PATH_HINT)
+if(PYTHON_EXECUTABLE)
+ if(WIN32)
+ get_filename_component(_PREFIX ${PYTHON_EXECUTABLE} PATH)
+ if(_PREFIX)
+ set(_Python_LIBRARY_PATH_HINT ${_PREFIX}/libs)
+ endif()
+ else()
+ get_filename_component(_PREFIX ${PYTHON_EXECUTABLE} PATH)
+ get_filename_component(_PREFIX ${_PREFIX} PATH)
+ if(_PREFIX)
+ set(_Python_LIBRARY_PATH_HINT ${_PREFIX}/lib)
+ endif()
+ endif()
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
# Search for the python framework on Apple.
CMAKE_FIND_FRAMEWORKS(Python)
@@ -112,6 +129,7 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
if(WIN32)
find_library(PYTHON_DEBUG_LIBRARY
NAMES python${_CURRENT_VERSION_NO_DOTS}_d python
+ HINTS ${_Python_LIBRARY_PATH_HINT}
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
@@ -134,6 +152,8 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
python${_CURRENT_VERSION}m
python${_CURRENT_VERSION}u
python${_CURRENT_VERSION}
+ HINTS
+ ${_Python_LIBRARY_PATH_HINT}
PATHS
${PYTHON_FRAMEWORK_LIBRARIES}
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
@@ -203,6 +223,7 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
endforeach()
unset(_Python_INCLUDE_PATH_HINT)
+unset(_Python_LIBRARY_PATH_HINT)
mark_as_advanced(
PYTHON_DEBUG_LIBRARY
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9d32dffb9397ce98806176f759fea4e77acf076
commit a9d32dffb9397ce98806176f759fea4e77acf076
Author: David Gobbi <david.gobbi at gmail.com>
AuthorDate: Mon Sep 14 22:48:49 2015 -0600
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Sep 17 11:28:49 2015 -0400
FindPythonLibs: Match include dir to library version
This commit ensures that FindPythonLibs has found the library before
before the search for the include dir begins. The library prefix and
version can then be used to find the matching include dir.
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 1c8776b..1220860 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -150,26 +150,41 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
PATH_SUFFIXES python${_CURRENT_VERSION}/config
)
- set(PYTHON_FRAMEWORK_INCLUDES)
- if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
- foreach(dir ${Python_FRAMEWORKS})
- list(APPEND PYTHON_FRAMEWORK_INCLUDES
- ${dir}/Versions/${_CURRENT_VERSION}/include)
- endforeach()
- endif()
+ # Don't search for include dir until library location is known
+ if(PYTHON_LIBRARY)
+
+ # Use the library's install prefix as a hint
+ set(_Python_INCLUDE_PATH_HINT)
+ get_filename_component(_PREFIX ${PYTHON_LIBRARY} PATH)
+ get_filename_component(_PREFIX ${_PREFIX} PATH)
+ if(_PREFIX)
+ set(_Python_INCLUDE_PATH_HINT ${_PREFIX}/include)
+ 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}
- )
+ # Add framework directories to the search paths
+ set(PYTHON_FRAMEWORK_INCLUDES)
+ if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
+ foreach(dir ${Python_FRAMEWORKS})
+ list(APPEND PYTHON_FRAMEWORK_INCLUDES
+ ${dir}/Versions/${_CURRENT_VERSION}/include)
+ endforeach()
+ endif()
+
+ find_path(PYTHON_INCLUDE_DIR
+ NAMES Python.h
+ HINTS
+ ${_Python_INCLUDE_PATH_HINT}
+ 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()
# For backward compatibility, set PYTHON_INCLUDE_PATH.
set(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}")
@@ -187,6 +202,8 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
endif()
endforeach()
+unset(_Python_INCLUDE_PATH_HINT)
+
mark_as_advanced(
PYTHON_DEBUG_LIBRARY
PYTHON_LIBRARY
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list