С++ CMake CMakePresets Ninja EditorConfig VS Code PCH app
Feel free to pick any part or snippet you find interesting.
CMakeLists.txt- CMake overview - decent examples and information sourceCMakePresets.json- build configure presets used inCMakeLists.txtviacacheVariablesmsvc-dbg: MSVC - debuggcc-dbg: GCC - debugclang-dbg: Clang - debug- some conditional presets with sanitizers (like:
gcc-san,clang-san-addr,clang-san-mem)
src/- place for project' source.cppfiles that are recursively globbed inCMakeLists.txt:26config.hpp- (optional) precompiled header with source-wide C++ defines
.code-workspace- useful VS Code settings
Compare branches: https://github.com/Challanger524/template-cpp/compare
GitHub compares for branch names with slash
/may be ill-formed, as shown in (?) link
Remark: I did not find any sane and useful C++ starting templates - they simply don't exist. For comparison, just take a look on what Golang community pulled out:
- Organizing a Go module - official golang project layout guideline
- https://github.com/golang-standards/project-layout - big detailed repo and layout showcase
- https://github.com/evrone/go-clean-template - same + readme contains pretty images
Projects and libraries (unfinished section)
Since there no useful templates outside - real projects are the only source of examples.
- https://github.com/nlohmann/json -
Libjsonc++readme.md(very decent) - ...
https://www.reddit.com/r/cpp_questions/comments/n73n32/presenting_a_c_project_on_github_elegantly/
Templates examples and demos
- https://github.com/TheCherno/ProjectTemplate -
Premake"Core/App" architecture - https://github.com/edumentab/cpp-project-example -
CMakeJetBrainsGTest - https://github.com/fnl/cpp-project-template -
CMake(nested)gitmodulesCatch2cxxopts - https://github.com/erayaydin/cpp-structure -
GNU Makeproject layout - https://github.com/karvozavr/multi-module-cpp-project-example -
CMakemulti-projectCatch2 - https://github.com/jblort/cpp-project-template -
CMakeConanlib+appCatch2 - https://github.com/ssciwr/cpp-project-template -
CMakeCI/CDDoxygenCatch2 - https://github.com/Jamagas/CMake -
CMakeGTest
- https://github.com/pvanhoof/dir-examples - the most ugly project layout example on the net -
MesonqmakeGNU MakeCMake(4 levels of nestiness)