{"id":15136938,"url":"https://github.com/madduci/moderncpp-project-template","last_synced_at":"2025-05-16T15:09:53.983Z","repository":{"id":56477766,"uuid":"137359955","full_name":"madduci/moderncpp-project-template","owner":"madduci","description":"A Modern C++ cross-platform Project Template with CMake, conan (optional), cppcheck (optional) and clang-format (optional)","archived":false,"fork":false,"pushed_at":"2024-10-27T16:32:46.000Z","size":26,"stargazers_count":291,"open_issues_count":0,"forks_count":47,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-12T14:56:01.781Z","etag":null,"topics":["clang-format","cmake","conan","cpp-course","cpp17","cppcheck"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/madduci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"madduci"}},"created_at":"2018-06-14T13:11:13.000Z","updated_at":"2025-03-28T10:39:16.000Z","dependencies_parsed_at":"2024-04-07T05:25:53.565Z","dependency_job_id":"c667c102-4961-4ba3-a8a7-677102907ce7","html_url":"https://github.com/madduci/moderncpp-project-template","commit_stats":{"total_commits":20,"total_committers":4,"mean_commits":5.0,"dds":0.35,"last_synced_commit":"91e824819140dc74e21741d6a9362fa62251d294"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madduci%2Fmoderncpp-project-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madduci%2Fmoderncpp-project-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madduci%2Fmoderncpp-project-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madduci%2Fmoderncpp-project-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madduci","download_url":"https://codeload.github.com/madduci/moderncpp-project-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254554016,"owners_count":22090418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clang-format","cmake","conan","cpp-course","cpp17","cppcheck"],"created_at":"2024-09-26T06:41:56.246Z","updated_at":"2025-05-16T15:09:48.975Z","avatar_url":"https://github.com/madduci.png","language":"CMake","readme":"# moderncpp-project-template\n\n![Static Build](https://github.com/madduci/moderncpp-project-template/workflows/Build-Static/badge.svg)\n\n![Shared Build](https://github.com/madduci/moderncpp-project-template/workflows/Build-Shared/badge.svg)\n\nThis repository aims to represent a template for Modern C++ projects, including static analysis checks, autoformatting, a BDD/TDD capable test-suite and packaging\n\n## Requirements\n\n* a modern C++17 compiler (`gcc-8`, `clang-6.0`, `MSVC 2017` or above)\n* [`cmake`](https://cmake.org) 3.15+\n* [`conan`](https://conan.io) 2.0+ (optional)\n* `cppcheck` (optional)\n* `clang-format` (optional)\n\n## Features\n\n* CMake-based project management, including dependencies\n* Conan support for dependency management in CMake, completely optional\n* Additional tools such as `clang-format` and `cppcheck`\n* Support for shared/static libraries, including generation of export information\n* Basic CPack configuration for redistributables\n* GitHub Actions\n\n## Repository layout\n\nThe 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:\n\n```plain\n-- conanfile.txt                - the main `conan` configuration file listing dependencies\n-- cppcheck_suppressions.txt    - optional list of suppressions for cppcheck\n-- CMakeLists.txt               - the main `CMake` Project configuration file\n-- .dockerignore                - files to be excluded by Docker\n-- .gitignore                   - files to be excluded by git\n+- `cmake/`                     - CMake modules\n  | -- clang-format.cmake       - CMake target definitions for clang-format\n  | -- compiler-options.cmake   - Common compiler options for major platforms/compilers\n  | -- cpack.cmake              - Packaging configuration with CPack\n  | -- dependencies.cmake       - Project dependencies, CMake-Style\n+- `project/`                   - the whole C++ project\n  | -- .clang-format            - the formatter rules for the C++ project\n  | -- CMakeLists.txt\n  | +- `helloapp/`              - your application files (including CMakeLists.txt, sources)\n  | +- `hellolib/`              - your library files (including CMakeLists.txt, sources\n+- `build/`                     - working directory for the build\n```\n\n## Available CMake Options\n\n* BUILD_TESTING     - builds the tests (requires `doctest`)\n* BUILD_SHARED_LIBS - enables or disables the generation of shared libraries\n* BUILD_WITH_MT     - valid only for MSVC, builds libraries as MultiThreaded DLL\n\nIf 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.\n\n## How to build from command line\n\nThe project can be built using the following commands:\n\n```shell\ncd /path/to/this/project\nmkdir -p build # md build (on Windows)\ncd build\nconan install .. --output-folder=. --build=missing\ncmake -DBUILD_TESTING=TRUE -DBUILD_SHARED_LIBS=TRUE -DCMAKE_BUILD_TYPE=Release ..\ncmake --build .\ncmake --build . --target format\ncmake --build . --target package\n```\n\n## How to build the project using a Docker Environment\n\n### Linux/gcc\n\n`docker run --rm -it -v $(pwd):/project madduci/docker-cpp-env:latest \"mkdir -p build \u0026\u0026 cd build \u0026\u0026 conan install .. \u0026\u0026 cmake -DBUILD_TESTING=TRUE -DBUILD_SHARED_LIBS=TRUE .. \u0026\u0026 cmake --build .\"`\n\n### Windows/msvc\n\n`docker run --rm -it -v $(pwd):/home/wine/.wine/drive_c/project madduci/docker-wine-msvc:17.8-2022`\n\nand then:\n\n```\nmd project/build\ncd project/build\nconan install --output-folder .  .. \ncmake -G \"Ninja\" -DBUILD_TESTING=TRUE  ..\ncmake --build .\n```\n","funding_links":["https://github.com/sponsors/madduci"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadduci%2Fmoderncpp-project-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadduci%2Fmoderncpp-project-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadduci%2Fmoderncpp-project-template/lists"}