如何在CMake中检查Windows版本
How to check Windows version in CMake?
我如何与CMake检查我是否正在配置Visual Studio解决方案,例如Windows 7或Windows 8?
有什么办法可以做到吗?
您可以使用CMAKE_SYSTEM_NAME
和CMAKE_SYSTEM_VERSION
## Check for Windows ##
if( WIN32 ) # true if windows (32 and 64 bit)
## Check for Version ##
if( ${CMAKE_SYSTEM_VERSION} EQUAL 6.1 ) # Windows 7
# Do something here
elseif( ${CMAKE_SYSTEM_VERSION} EQUAL 6.2 ) # Windows 8
# Do something here
else() # Some other Windows
# Do something here
endif()
endif()
相关文章:
- 在 c++ 中检查 Windows OS 服务器版本
- 如何在Windows上检查EXE是否具有/GS安全保护
- 如何检查 CNG Windows API 是否返回符合 FIPS 的算法实现
- 检查用户是否是 Windows 中本地计算机上的管理员C++
- C++ Windows - 以编程方式检查软件是否访问互联网?
- 检查任务栏中的当前应用程序吗?(C ,Windows API)
- 在 Windows 操作系统上使用C++检查特定的开放 TCP 端口
- 检查Windows激活状态返回错误的值
- 检查 Windows C++ 中自定义组的成员身份
- 使用 C/C++ 检查 Windows 中的软件安装和安装目录
- 如何检查Windows是否嵌入式或POS
- 如何在CMake中检查Windows版本
- 检查windows文件权限
- 检查Windows安装盘中是否存在file,是否已连接
- 如何检查Windows版本是否为正版
- 检查Windows计算机是否通过c++连接以太网
- 检查Windows机器是否可以作为RDP连接中的主机
- 如何以编程方式检查Windows Server 2016上是否安装了桌面体验
- 检查Windows 8中的设备是什么(pc / tablet)
- 检查Windows下静态库中是否包含main函数