A Modern C++ cross-platform Project Template with CMake, conan (optional), cppcheck (optional) and clang-format (optional)
CMake
333
29 commits
updated Sep 21, 2026
This repository aims to represent a template for Modern C++ projects, including static analysis checks, autoformatting, a BDD/TDD capable test-suite and packaging
gcc-11, clang-17.0, MSVC 2022 or above)cmake 4.0+conan 2.0+ (optional)cppcheck (optional)clang-format (optional)clang-format and cppcheckThe repository layout is pretty straightforward, including the CMake files to build the project, a conanfile where are declared examples of dependencies, a suppression list for cppcheck and the C++ source code:
-- conanfile.txt - the main `conan` configuration file listing dependencies
-- cppcheck_suppressions.txt - optional list of suppressions for cppcheck
-- CMakeLists.txt - the main `CMake` Project configuration file
-- .dockerignore - files to be excluded by Docker
-- .gitignore - files to be excluded by git
+- `cmake/` - CMake modules
| -- clang-format.cmake - CMake target definitions for clang-format
| -- compiler-options.cmake - Common compiler options for major platforms/compilers
| -- cpack.cmake - Packaging configuration with CPack
| -- dependencies.cmake - Project dependencies, CMake-Style
+- `project/` - the whole C++ project
| -- .clang-format - the formatter rules for the C++ project
| -- CMakeLists.txt
| +- `helloapp/` - your application files (including CMakeLists.txt, sources)
| +- `hellolib/` - your library files (including CMakeLists.txt, sources
+- `build/` - working directory for the build
doctest)If you activate the BUILD_TESTING flag, you need to perform in advance a conan install step, just to fetch the doctest dependency. Another dependency (OpenSSL) is used in this project as a demonstration of including a third-party library in the process, but it is totally optional and you can activate it only if you run conan in advance.
The project can be built using the following commands:
cd /path/to/this/project
mkdir -p build # md build (on Windows)
cd build
conan install .. --output-folder=. --build=missing
cmake -DBUILD_TESTING=TRUE -DBUILD_SHARED_LIBS=TRUE -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cmake --build . --target format
cmake --build . --target package
docker run --rm -it -v $(pwd):/project madduci/docker-cpp-env:latest "mkdir -p build && cd build && conan install .. && cmake -DBUILD_TESTING=TRUE -DBUILD_SHARED_LIBS=TRUE .. && cmake --build ."
28 commits
1 commits
CMake
71.3%
C++
19.8%
Dockerfile
8.9%
A Modern C++ cross-platform Project Template with CMake, conan (optional), cppcheck (optional) and clang-format (optional)
CMake
333
29 commits
updated Sep 21, 2026
This repository aims to represent a template for Modern C++ projects, including static analysis checks, autoformatting, a BDD/TDD capable test-suite and packaging
gcc-11, clang-17.0, MSVC 2022 or above)cmake 4.0+conan 2.0+ (optional)cppcheck (optional)clang-format (optional)clang-format and cppcheckThe repository layout is pretty straightforward, including the CMake files to build the project, a conanfile where are declared examples of dependencies, a suppression list for cppcheck and the C++ source code:
-- conanfile.txt - the main `conan` configuration file listing dependencies
-- cppcheck_suppressions.txt - optional list of suppressions for cppcheck
-- CMakeLists.txt - the main `CMake` Project configuration file
-- .dockerignore - files to be excluded by Docker
-- .gitignore - files to be excluded by git
+- `cmake/` - CMake modules
| -- clang-format.cmake - CMake target definitions for clang-format
| -- compiler-options.cmake - Common compiler options for major platforms/compilers
| -- cpack.cmake - Packaging configuration with CPack
| -- dependencies.cmake - Project dependencies, CMake-Style
+- `project/` - the whole C++ project
| -- .clang-format - the formatter rules for the C++ project
| -- CMakeLists.txt
| +- `helloapp/` - your application files (including CMakeLists.txt, sources)
| +- `hellolib/` - your library files (including CMakeLists.txt, sources
+- `build/` - working directory for the build
doctest)If you activate the BUILD_TESTING flag, you need to perform in advance a conan install step, just to fetch the doctest dependency. Another dependency (OpenSSL) is used in this project as a demonstration of including a third-party library in the process, but it is totally optional and you can activate it only if you run conan in advance.
The project can be built using the following commands:
cd /path/to/this/project
mkdir -p build # md build (on Windows)
cd build
conan install .. --output-folder=. --build=missing
cmake -DBUILD_TESTING=TRUE -DBUILD_SHARED_LIBS=TRUE -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cmake --build . --target format
cmake --build . --target package
docker run --rm -it -v $(pwd):/project madduci/docker-cpp-env:latest "mkdir -p build && cd build && conan install .. && cmake -DBUILD_TESTING=TRUE -DBUILD_SHARED_LIBS=TRUE .. && cmake --build ."
28 commits
1 commits
CMake
71.3%
C++
19.8%
Dockerfile
8.9%