[Cmake-commits] CMake branch, next, updated. v3.0.0-rc1-901-gb1b2708

Matt McCormick matt.mccormick at kitware.com
Wed Mar 12 12:02:14 EDT 2014


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  b1b270861d80e0a607c132f8b7f6d63136292ae0 (commit)
       via  3c4da3e39eb5f7267a0098602b68380717d4a6ed (commit)
      from  ecf89f88ad1f98caa981dbf8098825ad0970e925 (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=b1b270861d80e0a607c132f8b7f6d63136292ae0
commit b1b270861d80e0a607c132f8b7f6d63136292ae0
Merge: ecf89f8 3c4da3e
Author:     Matt McCormick <matt.mccormick at kitware.com>
AuthorDate: Wed Mar 12 12:02:13 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Mar 12 12:02:13 2014 -0400

    Merge topic 'different-python-header-libs-exe-0013794' into next
    
    3c4da3e3 FindPythonInterp: Use consistent version with PythonLibs. (#13794)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3c4da3e39eb5f7267a0098602b68380717d4a6ed
commit 3c4da3e39eb5f7267a0098602b68380717d4a6ed
Author:     Matt McCormick <matt.mccormick at kitware.com>
AuthorDate: Wed Mar 5 17:01:26 2014 -0500
Commit:     Matt McCormick <matt.mccormick at kitware.com>
CommitDate: Wed Mar 5 17:51:34 2014 -0500

    FindPythonInterp: Use consistent version with PythonLibs. (#13794)
    
    If
    
      find_package(PythonLibs)
      find_package(PythonInterp)
    
    is called, PythonInterp will get a version of PYTHON_EXECUTABLE inconsistent
    with the library versions found by PythonLibs.
    
    The PythonLibs version is searched for after the user specified
    Python_ADDITIONAL_VERSIONS and before the default versions.
    
    While this leads to consistent interpretor and library versions, it will not
    generate the same results since PythonInterp prefers the "python" executable,
    which is often installed as the system default.  To avoid a call to
    find_package(PythonInterp) inside FindPythonLibs.cmake, emit a developer
    warning when find_package(PythonLibs) is called before find_package(PythonInterp)
    and recommend the reverse.

diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 8da848c..9a2dbcc 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -71,18 +71,24 @@ if(PythonInterp_FIND_VERSION)
 else()
     set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
 endif()
-
-list(APPEND _Python_NAMES python)
-
-# Search for the current active python version first
 find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
 
 # 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}
-  )
+set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
+# If FindPythonInterp has already found the major and minor version,
+# insert that version next to get consistent versions of the interpreter and
+# library.
+if(DEFINED PYTHONLIBS_VERSION_STRING)
+  string(REPLACE "." ";" _PYTHONLIBS_VERSION "${PYTHONLIBS_VERSION_STRING}")
+  list(GET _PYTHONLIBS_VERSION 0 _PYTHONLIBS_VERSION_MAJOR)
+  list(GET _PYTHONLIBS_VERSION 1 _PYTHONLIBS_VERSION_MINOR)
+  list(APPEND _Python_VERSIONS ${_PYTHONLIBS_VERSION_MAJOR}.${_PYTHONLIBS_VERSION_MINOR})
+  message(AUTHOR_WARNING "Call find_package(PythonInterp) before find_package(PythonLibs) to get the currently active Python version by default.")
+endif()
+# Search for the current active python version first
+list(APPEND _Python_VERSIONS ";")
+list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
 
 unset(_PYTHON_FIND_OTHER_VERSIONS)
 unset(_PYTHON1_VERSIONS)
@@ -91,7 +97,7 @@ unset(_PYTHON3_VERSIONS)
 
 # Search for newest python version if python executable isn't found
 if(NOT PYTHON_EXECUTABLE)
-    foreach(_CURRENT_VERSION ${_Python_VERSIONS})
+    foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS)
       set(_Python_NAMES python${_CURRENT_VERSION})
       if(WIN32)
         list(APPEND _Python_NAMES python)

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

Summary of changes:
 Modules/FindPythonInterp.cmake |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list