07-cmake语法-MATCHES

如果给定的字串或变量值域给定的正则表达式匹配的话,表达式返回真。

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")  

  

或者

IF(NOT (src MATCHES ".*2009-10-20.*"))
...

  

 

posted @ 2018-04-18 15:46  路边的十元钱硬币  阅读(5228)  评论(0编辑  收藏  举报