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  cbffa2d6e4b6543ac06379814b494ef4cbb5ef68 (commit)
       via  89717916b8c973c292a4c0a058ee552fcbf40850 (commit)
      from  f1a93c6a3bd676834bf2f88b983e6eca4e1e3072 (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=cbffa2d6e4b6543ac06379814b494ef4cbb5ef68
commit cbffa2d6e4b6543ac06379814b494ef4cbb5ef68
Merge: f1a93c6 8971791
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Sep 17 09:43:36 2015 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Thu Sep 17 09:43:36 2015 -0400

    Merge topic 'FindPython-updates' into next
    
    89717916 FindPythonLibs: Match include dir to library version


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89717916b8c973c292a4c0a058ee552fcbf40850
commit 89717916b8c973c292a4c0a058ee552fcbf40850
Author:     David Gobbi <david.go...@gmail.com>
AuthorDate: Mon Sep 14 22:48:49 2015 -0600
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Thu Sep 17 09:41:53 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..19244da 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(_INCLUDE_PATH_HINT)
+    get_filename_component(_PREFIX ${PYTHON_LIBRARY} PATH)
+    get_filename_component(_PREFIX ${_PREFIX} PATH)
+    if(_PREFIX)
+      set(_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
+        ${_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}")

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindPythonLibs.cmake |   53 +++++++++++++++++++++++++++---------------
 1 file changed, 34 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to