cmake平台判断

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

if(WIN32)
    message("Now is windows")
elseif(APPLE)
    message("Now is Apple systens.")
elseif(UNIX)
    message("Now is UNIX-like OS's. Including APPLE os x and CygWin")
endif()
reflectintheflow
“ 道之所存,虽千万人吾往矣;情之所钟,世俗礼易如粪土;兴之所在,与君痛饮三百杯 ”
 喜欢文章
头像