camke中判斷操做系統平臺有兩種方法:windows
1.操作系統
MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM}")
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")
MESSAGE(STSTUS "###################################")
2..net
IF (WIN32)
MESSAGE(STATUS "Now is windows")
ELSEIF (APPLE)
MESSAGE(STATUS "Now is Apple systens.")
ELSEIF (UNIX)
MESSAGE(STATUS "Now is UNIX-like OS's.")
ENDIF ()
---------------------
做者:CodeApe123
來源:CSDN
原文:https://blog.csdn.net/sean_8180/article/details/81189996
版權聲明:本文爲博主原創文章,轉載請附上博文連接!orm