cmake配置
-
官网下载并安装
-
设置系统环境变量
shellcmake --version
-
vsCode插件
Clang/LLVM配置
-
vsCode clangd插件,提示安装lsp
-
官网下载LLVM
-
安装包安装,设置系统环境变量
shellclang --version
ninja配置
-
官网下载
-
解压,设置系统环境变量
shellninja --version
test
-
hello world程序
-
CMakeLists.txt
cmakecmake_minimum_required(VERSION 3.10) project(my_project) set(CMAKE_CXX_STANDARD 23) add_executable(my_program man.cpp)
-
build脚本
bash@echo off if exist "build" ( echo delete build... rmdir /s /q "build" if %errorlevel% neq 0 ( echo delete build error pause exit /b ) ) echo mkdir build... mkdir "build" cd build cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=Release -GNinja .. ninja cd ..