A clean, modern template for bootstrapping C++26 projects. It is specifically tailored for a seamless IDE experience using VSCode Remote Development (WSL on Windows or Lima on macOS) targeting Ubuntu 24.04+.
- Modern C++26: Configured for GCC 15+ to utilize the latest standard features like
std::print. - CMake 4.0+: Utilizes modern CMake patterns, requiring at least version 4.0.
- vcpkg Integration: Dependency management is streamlined via a
vcpkggit submodule and avcpkg.jsonmanifest. - VSCode Ready: Includes
CMakePresets.jsonand.vscode/settings.jsonconfigured for the Ninja generator, providing out-of-the-box IntelliSense, formatting, and debugging. - Strict Compilation: Enforces extensive non-trivial compiler warnings (e.g.,
-Wshadow,-Wconversion,-Wpedantic). - Sanitizers Built-in: Debug builds automatically enforce
-Werrorand enable AddressSanitizer (ASan) and UndefinedBehaviorSanitizer (UBSan). - Testing: Pre-configured with Catch2 and CTest for immediate test-driven development.
- OS: Ubuntu 24.04 or higher (running natively, or via WSL/Lima).
- Compiler: GCC >= 15.
- Build System: CMake >= 4.0 and Ninja.
- IDE: Visual Studio Code with the C/C++ and CMake Tools extensions installed on the remote host.
-
Connect to Remote: Open VSCode and connect to your remote environment (WSL, Lima, etc).
-
Setup a new project:
git clone git@github.com:maorgershman/cpp-template my-project cd my-project rm -rf .git vcpkg git init git submodule add git@github.com:microsoft/vcpkg git add . git commit -m "Initial commit"
-
Open Folder: Open the
my-projectfolder in VSCode. -
Customize: Consider customizing
README.mdandLICENSEto your project's needs. -
Enjoy!
- The CMake Tools extension will automatically detect the
debugpreset. - Use the Configure, Build, Debug, and Test buttons in the VSCode status bar or sidebar.
- All dependencies (like Catch2) and sanitizers (ASan, UBSan) are handled automatically through the IDE interface.
- The CMake Tools extension will automatically detect the
Note: The template includes vcpkg as a submodule. Because git clone
does not fetch submodules by default, the directory will appear empty
after cloning. The setup step above replaces it with a fresh submodule
owned by the new repository.
This project is licensed under the MIT License.