1. INCLUDE_DIRECOTRIES
设置头文件目录
例如:INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include)
2. LINK_DIRECTORIES
设置lib文件目录
例如:LINK_DIRECTORIES( ${PROJECT_SOURCE_DIR}/lib )
3.ADD_EXECUTABLE/ADD_LIBRARY
设置生成target
例如:ADD_EXECUTABLE(Test test.cpp test.h)
4. TARGET_LINK_LIBRARIES
设置连接lib
例如:TARGET_LINK_LIBRARIES(Test pthread)
5.ADD_SUBDIRECTORY()
设置要处理的子目录
6. SET_TARGET_PROPERTIES
设置生成目标的属性
例如在windows平台上设置一个dll的到处函数模块定义文件:SET_TARGET_PROPERTIES(Test PROPERTIES LINK_FLAGS /DEF:"${CMAKE_CURRENT_SOURCE_DIR}/test.def" )
7. ADD_DEPENDENCIES
设置目标依赖
例如:ADD_DEPENDENCIES(Test other)