CMakeDetermineVSServicePack¶
版本 4.1 中已更改: 此模块仅在策略 CMP0196 未设置为 NEW 时可用。
版本 3.0 已弃用: 此模块不应再使用。此模块的功能已被 CMAKE_<LANG>_COMPILER_VERSION 变量取代,该变量包含编译器版本号。
此模块提供了一个命令,用于确定 Visual Studio 2012 及更早版本的已安装 Visual Studio Service Pack 版本。
在 CMake 项目中加载此模块,使用
include(CMakeDetermineVSServicePack)
命令¶
此模块提供以下命令
- DetermineVSServicePack¶
确定正在使用的
cl编译器的 Visual Studio Service Pack 版本DetermineVSServicePack(<variable>)
结果将存储在指定的内部缓存变量
<variable>中,该变量将被设置为以下值之一,或者在无法确定 Service Pack 时设置为空字符串vc80,vc80sp1vc90,vc90sp1vc100,vc100sp1vc110,vc110sp1,vc110sp2,vc110sp3,vc110sp4
示例¶
在项目中确定 Visual Studio Service Pack 版本
if(MSVC)
include(CMakeDetermineVSServicePack)
DetermineVSServicePack(my_service_pack)
if(my_service_pack)
message(STATUS "Detected: ${my_service_pack}")
endif()
endif()