This is my personal cmake template, it's mostly vibe-coded and it's made to fit my usecase I'm open to any suggestions to make it better I will be updating it in case I learned more about cmake.
A project can be created using cmake, two starter templates are available cli and gui.
cmake -DNAME=<project_name> -P ./cmake/new_project.cmakefor GUI which uses WinMain instead of the normal int main().
cmake -DNAME=<project_name> -DGUI=ON -P ./cmake/new_project.cmakeThe command will create a directory with a starter main.cpp file and add the directory to the root CMakeLists.txt.
cmake -DNAME=<project_name> -DSINGLE=ON -P ./cmake/new_project.cmakesingle mode can be used for singular project folders the root will contain the src of the project.
configure the project
cmake -S . -B buildTo build all projects.
cmake --build build To build a specific project
cmake --build build --target <project_name>By default the project will be built using Debug config, though it can be configured using --config parameter
cmake --build build --config Release --target <project_name>You can always omit project_name to build all projects.
To run the project you will find the final exe at build/<project_name>/<config>/ (e.g: build/getVersion/Release).