Commit a6fee73d authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'CMakeDetermineVSServicePack-vs-11-update-4'

f0de3f80 CMakeDetermineVSServicePack: Add VS 11 update 4
105658df CMakeDetermineVSServicePack: Match versions more robustly
101515b9 CMakeDetermineVSServicePack: Format documentation
parents 893843ce f0de3f80
......@@ -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_<LANG>_COMPILER_VERSION that contains the compiler
# version number.
# The functionality of this module has been superseded by the
# :variable:`CMAKE_<LANG>_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, vc110sp4
#=============================================================================
# Copyright 2009-2013 Kitware, Inc.
......@@ -68,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()
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment