https://github.com/karnkaul/cpp-template
C++20 CMake Project Template (Executable)
https://github.com/karnkaul/cpp-template
cmake cpp cpp20 github-actions
Last synced: 7 months ago
JSON representation
C++20 CMake Project Template (Executable)
- Host: GitHub
- URL: https://github.com/karnkaul/cpp-template
- Owner: karnkaul
- License: gpl-3.0
- Created: 2020-02-26T06:21:29.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2022-01-09T22:58:15.000Z (about 4 years ago)
- Last Synced: 2025-04-11T21:01:57.934Z (12 months ago)
- Topics: cmake, cpp, cpp20, github-actions
- Language: CMake
- Homepage:
- Size: 50.8 KB
- Stars: 9
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C++20 CMake Project Template (Executable)
Sets up a minimalist C++20 CMake executable project with a few basic add-ons.
[](https://github.com/karnkaul/cpp-template/actions/workflows/ci.yml)
## Features
- Dotfiles
- `.clang-format`
- `.editorconfig`
- `.gitignore`
- `.gitattributes`
- CMake scripts:
- `CMakeLists.txt`: project script, also sets up git commit hash / option to update submodules, `compile_commands.json` export, etc
- `cmake/interface.cmake`: sets up interface library with compile flags etc
- `cmake/build.cmake` : configures, builds, and installs a ninja/clang build using a desired build configuration
- `cmake/CMakePresets.json`: ninja/clang and inherited presets (copy/symlink to project root to use)
- `config.cmake.in`: package config file input
- GitHub CI integration:
- `.github/workflows/ci.yml` : runs a matrix build on Windows and Ubuntu, invoking `cmake/build.cmake`
## Usage
1. Clone repo / use as template
1. Modify the `project parameters` section in `CMakeLists.txt`
1. `project_name`: name to use for root project and prefix for interface library
1. `${project_name}_version_file`: version file to configure (optional)
1. `${project_name}_version`, `${project_name}_soversion`: used for versioning
1. `cxx_standard`: compile feature on interface library
1. Make any other changes if desired
1. Configure
1. If using Ninja + clang and CMake 3.20+, use presets eg: `cmake -S . --preset=nc-debug` for `Debug`
1. Build and debug/run
[Original repository](https://github.com/karnkaul/cpp-template)
[LICENCE](LICENSE)