CMakeList
安装
- sudo apt install cmake
- 源码安装,官方下载,命令行编译安装
基础脚本
CMakeLists.txt
cmake_minimum_required(VERSION 3.22)
message("myProject")
add_executable(myExec main.cc)
main.cc
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
cout << "Hello" << endl;
return 0;
}
编译方法
- mkdir build && cd build
- cmake .. or cmake -G "Unix Makefiles" ..