cmake中常用指令和变量
cmake的help可以帮助我们查询陌生命令和变量
未知命令,以“cmake_minimum_required”为例:
cmake --help-command cmake_minimum_required
未知变量,以“CMAKE_BUILD_TYPE”为例:
cmake --help-variable CMAKE_BUILD_TYPE
下面列举几个常用的命令和变量:
一、命令
1. cmake_minimum_required
2. project
3. set
4. list
5. include
6. option
7. message
8. file
9. add_library
10. add_executable
11. target_link_libraries
12. add_subdirectory
二、变量
1. CMAKE_BUILD_TYPE
2. CMAKE_CXX_FLAGS
3. CMAKE_CXX_STANDARD
4. PROJECT_SOURCE_DIR
5. PROJECT_BINARY_DIR
6. GLOB_RECURSE
7. CMAKE_RUNTIME_OUTPUT_DIRECTORY
8. EXECUTABLE_OUTPUT_PATH
9. LIBRARY_OUTPUT_PATH
10. ARCHIVE_OUTPUT_DIRECTORY