DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

CMake是一个跨平台的工程管理工具,能方便的把工程转换为vs各个版本、Borland Makefiles、MSSYS Makefiles、NMake Makefiles等工程,对于经常在不同IDE下使用管理同一个工程提供了很大的便利。自己把使用过程中的点点滴滴记录下来。

list 列表操作命令。

1、 list(LENGTH <list> <output variable>)

2、 list(GET <list> <element index> [<element index> ...] <output variable>)
3、 list(APPEND <list> <element> [<element> ...])
4、 list(FIND <list> <value> <output variable>)

例:(摘自WebKit-r169998的cmakliset文件)

 

[plain] view plain copy
 
 print?
  1. # -----------------------------------------------------------------------------  
  2. # Determine which port will be built  
  3. # -----------------------------------------------------------------------------  
  4. #定义ALL_PORTS  
  5. set(ALL_PORTS Efl WinCE GTK)  
  6. set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")  
  7. set(PORT GTK)  
  8. #在ALL_PORTS中查找 ${PORT} == "GTK",并返回在ALL_PORTS 之中的索引 RET  
  9. list(FIND ALL_PORTS ${PORT} RET)  
  10. if (${RET} EQUAL -1)  
  11.     message(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")  
  12. endif ()  

 

 

 


    list(INSERT <list> <element_index> <element> [<element> ...])
    list(REMOVE_ITEM <list> <value> [<value> ...])
    list(REMOVE_AT <list> <index> [<index> ...])
    list(REMOVE_DUPLICATES <list>)
    list(REVERSE <list>)
    list(SORT <list>)

posted on 2017-08-17 10:32  DoubleLi  阅读(3797)  评论(0编辑  收藏  举报