From 101515b958864cbcb42340d0d6d337fec9f44b18 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Apr 2014 11:01:46 -0400 Subject: CMakeDetermineVSServicePack: Format documentation Also state explicitly that the module is deprecated. --- Modules/CMakeDetermineVSServicePack.cmake | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index 353aed6..d11cdb8 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -2,15 +2,15 @@ # CMakeDetermineVSServicePack # --------------------------- # -# Determine the Visual Studio service pack of the 'cl' in use. +# Deprecated. Do not use. # -# The functionality of this module has been superseded by the platform -# variable CMAKE__COMPILER_VERSION that contains the compiler -# version number. +# The functionality of this module has been superseded by the +# :variable:`CMAKE__COMPILER_VERSION` variable that contains +# the compiler version number. # -# Usage: +# Determine the Visual Studio service pack of the 'cl' in use. # -# :: +# Usage:: # # if(MSVC) # include(CMakeDetermineVSServicePack) @@ -21,14 +21,12 @@ # endif() # # Function DetermineVSServicePack sets the given variable to one of the -# following values or an empty string if unknown: -# -# :: +# following values or an empty string if unknown:: # # vc80, vc80sp1 # vc90, vc90sp1 # vc100, vc100sp1 -# vc110, vc110sp1, vc110sp2 +# vc110, vc110sp1, vc110sp2, vc110sp3 #============================================================================= # Copyright 2009-2013 Kitware, Inc. -- cgit v0.12 From 105658df0280f2d2fd30cec32e0f4176874b23b0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Apr 2014 11:03:32 -0400 Subject: 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 d11cdb8..fbcaec7 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -84,27 +84,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() @@ -125,20 +112,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() -- cgit v0.12 From f0de3f80bb573b46a803094226ae9e5f1d5e1fbc Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Apr 2014 12:26:21 -0400 Subject: CMakeDetermineVSServicePack: Add VS 11 update 4 --- Modules/CMakeDetermineVSServicePack.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index fbcaec7..2854387 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -26,7 +26,7 @@ # vc80, vc80sp1 # vc90, vc90sp1 # vc100, vc100sp1 -# vc110, vc110sp1, vc110sp2, vc110sp3 +# vc110, vc110sp1, vc110sp2, vc110sp3, vc110sp4 #============================================================================= # Copyright 2009-2013 Kitware, Inc. @@ -66,6 +66,8 @@ function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version) set(_version "vc110sp2") elseif(${_cl_version} VERSION_EQUAL "17.00.60610.1") set(_version "vc110sp3") + elseif(${_cl_version} VERSION_EQUAL "17.00.61030") + set(_version "vc110sp4") else() set(_version "") endif() -- cgit v0.12