操作系统判断方式

转载:https://blog.csdn.net/hw140701/article/details/90203141
例如操作系统判断方式一:

if(WIN32)
message(STATUS “This operating system is Windows.”)
elseif(UNIX)
message(STATUS “This operating system is Linux.”)
elseif(APPLE)
message(STATUS “This operating system is APPLE.”)
endif(WIN32)

操作系统判断方式二:

if (CMAKE_SYSTEM_NAME MATCHES “Linux”)
message(STATUS "current platform: Linux ")
elseif (CMAKE_SYSTEM_NAME MATCHES “Windows”)
message(STATUS “current platform: Windows”)
elseif (CMAKE_SYSTEM_NAME MATCHES “FreeBSD”)
message(STATUS “current platform: FreeBSD”)
else ()
message(STATUS “other platform: ${CMAKE_SYSTEM_NAME}”)
endif (CMAKE_SYSTEM_NAME MATCHES “Linux”)

发布了37 篇原创文章 · 获赞 5 · 访问量 2166

猜你喜欢

转载自blog.csdn.net/weixin_44723106/article/details/103800951
今日推荐