CMake相关记录
1.添加第三方库
## yaml-cpp set(YAML_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/third-party/yaml-cpp/include) set(YAML_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/third-party/yaml-cpp/lib) include_directories(${YAML_INCLUDE_PATH}) find_library(YAML_LIB NAMES yaml-cpp PATHS ${YAML_LIB_PATH})
2.编译和链接
add_definitions("-g") //添加编译选项
add_executable(${PROJECT_NAME} test.cpp)
target_link_libraries(${PROJECT_NAME} ${YAML_LIB})
3.执行shell脚本((107条消息) cmake:使用execute_process调用shell命令或脚本_execute_process sh_MagnumLu的博客-CSDN博客)
execute_process(COMMAND <一句shell命令> WORKING_DIRECTORY <这句shell命令执行的工作目录>)