Startup

CMakeLists.txt

$ mkdir cmake-project
$ cd cmake-project
$ touch CMakeLists.txt

Code

$ mkdir src && vim src/main.cpp

Config

cmake_minimum_required(VERSION 3.10)

# set the project name
project(Tutorial)

# add the executable
add_executable(Tutorial src/main.cpp)

Build

$ mkdir build && cd build
$ cmake ..
$ make

Run

$ ./Tutorial
Hello, CMake.

最后更新于

这有帮助吗?