创建文件和文件夹
创建文件夹
mkdir HelloWorldTest
cd HelloWorldTest
编写 cpp 文件
创建文件夹
type null > hello-world.cpp
编写文件
#include<string>
#include<iostream>
int main(int argc, char**argv)
{
std::cout<<"Hello World"<<std::endl;
return 0;
}
创建 CMakeLists.txt 文件
type null > CMakeLists.txt
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(hello-world-01 LANGUAGES CXX)
add_executable(hello-world hello-world.cpp)
生成和编译
生成 sln 工程
cmake -G "Visual Studio 16 2019" -A Win32 -B .\build
编译 sln 工程
cmake --build . --config Release