cmake文件基本结构
文件名 CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
# set the project name
project(Tutorial)
# add the executable
add_executable(Tutorial tutorial.cxx)
指令介绍
名称 | 参数 | 说明 |
---|---|---|
set | 参数名 值 | 定义变量 |
add_executable | 可执行程序名 源文件 | 生成可执行程序 |
target_link_libraries | ||
messages | ||
find_package | ||
include_directories | ||
include |
简单使用技巧
保存安装和编译信息
make | tee LOG_make.txt
make install | tee LOG_install.txt
make >& LOG_make.txt
make install >& LOG_install.txt
C++ 版本设置