CMakeDetermineVSServicePack
Changed in version 4.1: This module is available only if policy CMP0196 is not set to NEW.
Deprecated since version 3.0: This module should no longer be used. The functionality of this module has been superseded by the CMAKE_<LANG>_COMPILER_VERSION variable that contains the compiler version number.
This module provides a command to determine the installed Visual Studio service pack version for Visual Studio 2012 and earlier.
Load this module in a CMake project with:
include(CMakeDetermineVSServicePack)
Commands
This module provides the following command:
-
DetermineVSServicePack -
Determines the Visual Studio service pack version of the
clcompiler in use:DetermineVSServicePack(<variable>)
The result is stored in the specified internal cache variable
<variable>, which is set to one of the following values, or to an empty string if the service pack cannot be determined:-
vc80,vc80sp1 -
vc90,vc90sp1 -
vc100,vc100sp1 -
vc110,vc110sp1,vc110sp2,vc110sp3,vc110sp4
-
Examples
Determining the Visual Studio service pack version in a project:
if(MSVC)
include(CMakeDetermineVSServicePack)
DetermineVSServicePack(my_service_pack)
if(my_service_pack)
message(STATUS "Detected: ${my_service_pack}")
endif()
endif()
© 2000–2026 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.
https://cmake.org/cmake/help/latest/module/CMakeDetermineVSServicePack.html