A modern C++23 project template using:
- CMake
- vcpkg (Manifest Mode)
- Ninja
- clangd
- clang-format
- clang-tidy
The template is Linux-first but fully supports Windows.
Important
In case VSCode or another editor is acting up in regards to files not being found or classes not existing, make sure to restart the clangd language server, that should fix the issue. Also note that you should first run one of the build scripts (build.sh for Unix systems, build.bat for Windows) to generate the compiler commands.
- C++23
- vcpkg dependency management
- CMake Presets
- clangd-ready
- VS Code ready
- Neovim friendly
- GCC, Clang and MSVC support
sudo dnf install \
git \
gcc-c++ \
clang \
clang-tools-extra \
cmake \
ninja-build \
lldb \
python3sudo apt install \
git \
build-essential \
clang \
clang-tools \
cmake \
ninja-build \
lldb \
python3sudo pacman -S \
git \
base-devel \
clang \
cmake \
ninja \
lldb \
pythonsudo zypper install \
git \
gcc-c++ \
clang \
clang-tools \
cmake \
ninja \
lldb \
python3Install:
- Visual Studio 2022 Build Tools (Desktop development with C++)
- CMake
- Ninja
- Git
- LLVM (clang, clang-format, clang-tidy, lldb)
Clone vcpkg somewhere permanent.
git clone https://github.com/microsoft/vcpkg.git ~/Development/tools/vcpkgBootstrap it.
Linux/macOS:
cd ~/Development/tools/vcpkg
./bootstrap-vcpkg.shWindows:
bootstrap-vcpkg.batLinux:
export VCPKG_ROOT=$HOME/Development/tools/vcpkgAdd that to your shell configuration (~/.bashrc, ~/.zshrc, etc.).
Windows:
setx VCPKG_ROOT C:\Development\vcpkgRestart your terminal afterwards.
To use this template you have 2 options
- Clone the Repository
mkdir your-cpp-project
cd your-cpp-project
git clone https://github.com/TheVolpeDev/cpp-vcpkg-cmake-template.git .- Create a repository based on this template
For this you can either click the "Use This Template" button on the Github web interface, or use this link for quick creation
Debug
./build.shRelease
./build.sh releaseWindows
build.bat
build.bat releaseEdit vcpkg.json.
Example:
{
"dependencies": ["fmt", "spdlog", "entt"]
}Re-run the build script.
vcpkg will automatically install any missing dependencies.
- clangd
- CMake Tools
- CodeLLDB
The repository already recommends these extensions automatically.
The template generates compile_commands.json, allowing clangd to work without any additional configuration.