[Cmake-commits] CMake branch, next, updated. v2.8.11.2-4066-gcc33c4c

Rolf Eike Beer eike at sf-mail.de
Sat Aug 31 11:47:31 EDT 2013


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  cc33c4c0f3557cd153dfc196fc29ec4f834c4253 (commit)
       via  afd4f7f0428f48c6a01eb828dd07e057048edc49 (commit)
      from  b0761face54aa8eab247a7f0d0da9dfc100d0095 (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=cc33c4c0f3557cd153dfc196fc29ec4f834c4253
commit cc33c4c0f3557cd153dfc196fc29ec4f834c4253
Merge: b0761fa afd4f7f
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Sat Aug 31 11:47:29 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Aug 31 11:47:29 2013 -0400

    Merge topic 'FindPython_versions' into next
    
    afd4f7f FindPython*: simplify version selection


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=afd4f7f0428f48c6a01eb828dd07e057048edc49
commit afd4f7f0428f48c6a01eb828dd07e057048edc49
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Sat Aug 31 17:46:44 2013 +0200
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Sat Aug 31 17:46:44 2013 +0200

    FindPython*: simplify version selection
    
    CMake already provides the version components split into variables, no need to
    split them again.

diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 7fb65b8..b6b7897 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -36,28 +36,30 @@ 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)
 
 if(PythonInterp_FIND_VERSION)
-    if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
-        string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}")
-        string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
-        list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ})
+    if(PythonInterp_FIND_VERSION_COUNT GREATER 1)
+        set(_PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION_MAJOR}.${PythonInterp_FIND_VERSION_MINOR}")
+        list(APPEND _Python_NAMES
+             python${_PYTHON_FIND_MAJ_MIN}
+             python${PythonInterp_FIND_VERSION_MAJOR})
         unset(_PYTHON_FIND_OTHER_VERSIONS)
         if(NOT PythonInterp_FIND_VERSION_EXACT)
-            foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
+            foreach(_PYTHON_V ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS})
                 if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
                     list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
                 endif()
              endforeach()
         endif()
         unset(_PYTHON_FIND_MAJ_MIN)
-        unset(_PYTHON_FIND_MAJ)
     else()
-        list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION})
-        set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS})
+        list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION_MAJOR})
+        set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS})
     endif()
 else()
     set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
 endif()
 
+message(STATUS "names ${_Python_NAMES}")
+message(STATUS "other versions ${_PYTHON_FIND_OTHER_VERSIONS}")
 list(APPEND _Python_NAMES python)
 
 # Search for the current active python version first
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index bffa9fb..8356ed9 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -41,9 +41,8 @@ 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)
 
 if(PythonLibs_FIND_VERSION)
-    if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
-        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}")
+    if(PythonLibs_FIND_VERSION_COUNT GREATER 1)
+        set(_PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION_MAJOR}.${PythonLibs_FIND_VERSION_MINOR}")
         unset(_PYTHON_FIND_OTHER_VERSIONS)
         if(PythonLibs_FIND_VERSION_EXACT)
             if(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
@@ -52,16 +51,15 @@ if(PythonLibs_FIND_VERSION)
                 set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}")
             endif()
         else()
-            foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
+            foreach(_PYTHON_V ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS})
                 if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
                     list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
                 endif()
              endforeach()
         endif()
         unset(_PYTHON_FIND_MAJ_MIN)
-        unset(_PYTHON_FIND_MAJ)
     else()
-        set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS})
+        set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS})
     endif()
 else()
     set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})

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

Summary of changes:
 Modules/FindPythonInterp.cmake |   18 ++++++++++--------
 Modules/FindPythonLibs.cmake   |   10 ++++------
 2 files changed, 14 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list