On 04/10/2014 04:19 AM, Mourad Boufarguine wrote:
> I just tried with CMake 2.8.12.2 and I confirm I had the same issue. 

Okay, then it is not a regression in 3.0 but still needs to be fixed.

> Microsoft (R) C/C++ Optimizing *Compiler Version 17.00.61030* for x64

That is a higher third component value than CMakeDetermineVSServicePack
has for vc110sp3 (17.00.60610.1).  What service pack level is it?

>> Meanwhile, Eigen should be taught to use CMAKE_<LANG>_COMPILER_VERSION
> All I can do here is to let Eigen developers know of this issue.

Yes.  CMakeDetermineVSServicePack should not be used anymore.  It
is not reliable or future-proof because it has to be taught about
every service pack's exact version number.

> However, since CMakeDetermineVSServicePack is still shipped with
> CMake 3.0, it has to be fixed anyway.

Yes, it looks like it needs to be taught to tolerate unknown service
pack levels without failing.  Please try the attached patch.  It is
not expected to find the right service pack for your (newer) version
but should prevent outright failure.

Thanks,
-Brad

>From 64ee2a7d7e873d6c71aa23bb93c02acde2f2fc83 Mon Sep 17 00:00:00 2001
Message-Id: <64ee2a7d7e873d6c71aa23bb93c02acde2f2fc83.1397142703.git.brad.k...@kitware.com>
From: Brad King <[email protected]>
Date: Thu, 10 Apr 2014 11:03:32 -0400
Subject: [PATCH] CMakeDetermineVSServicePack: Match versions more robustly

Use the CMAKE_MATCH_* variables to simplify matching logic.  Match
either 3 or 4 version components.  Do not fail when there are only three
components available.
---
 Modules/CMakeDetermineVSServicePack.cmake | 38 ++++++-------------------------
 1 file changed, 7 insertions(+), 31 deletions(-)

diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake
index 353aed6..69e3cd1 100644
--- a/Modules/CMakeDetermineVSServicePack.cmake
+++ b/Modules/CMakeDetermineVSServicePack.cmake
@@ -86,27 +86,14 @@ function(_DetermineVSServicePack_FastCheckVersionWithCompiler _SUCCESS_VAR  _VER
           OUTPUT_QUIET
         )
 
-      string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+"
-        _cl_version "${_output}")
-
-      if(_cl_version)
-        string(REGEX MATCHALL "[0-9]+"
-            _cl_version_list "${_cl_version}")
-        list(GET _cl_version_list 0 _major)
-        list(GET _cl_version_list 1 _minor)
-        list(GET _cl_version_list 2 _patch)
-        list(GET _cl_version_list 3 _tweak)
-
+      if(_output MATCHES "Compiler Version (([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\.([0-9]+))?)")
+        set(_cl_version ${CMAKE_MATCH_1})
+        set(_major ${CMAKE_MATCH_2})
+        set(_minor ${CMAKE_MATCH_3})
         if("${_major}${_minor}" STREQUAL "${MSVC_VERSION}")
-          set(_cl_version ${_major}.${_minor}.${_patch}.${_tweak})
-        else()
-          unset(_cl_version)
-        endif()
-      endif()
-
-      if(_cl_version)
           set(${_SUCCESS_VAR} true PARENT_SCOPE)
           set(${_VERSION_VAR} ${_cl_version} PARENT_SCOPE)
+        endif()
       endif()
     endif()
 endfunction()
@@ -127,20 +114,9 @@ function(_DetermineVSServicePack_CheckVersionWithTryCompile _SUCCESS_VAR  _VERSI
 
     file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc")
 
-    string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+"
-      _cl_version "${_output}")
-
-    if(_cl_version)
-      string(REGEX MATCHALL "[0-9]+"
-          _cl_version_list "${_cl_version}")
-
-      list(GET _cl_version_list 0 _major)
-      list(GET _cl_version_list 1 _minor)
-      list(GET _cl_version_list 2 _patch)
-      list(GET _cl_version_list 3 _tweak)
-
+    if(_output MATCHES "Compiler Version (([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\.([0-9]+))?)")
       set(${_SUCCESS_VAR} true PARENT_SCOPE)
-      set(${_VERSION_VAR} ${_major}.${_minor}.${_patch}.${_tweak} PARENT_SCOPE)
+      set(${_VERSION_VAR} "${CMAKE_MATCH_1}" PARENT_SCOPE)
     endif()
 endfunction()
 
-- 
1.8.5.2

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to