{"id":21741973,"url":"https://github.com/mortinger91/cpp-cmake-template","last_synced_at":"2025-04-13T04:35:07.831Z","repository":{"id":78981460,"uuid":"593248612","full_name":"mortinger91/cpp-cmake-template","owner":"mortinger91","description":"Template for a C++ CMake project, using Github Actions and CTest.","archived":false,"fork":false,"pushed_at":"2024-08-07T00:51:20.000Z","size":118,"stargazers_count":36,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T05:36:28.684Z","etag":null,"topics":["cmake","cpp","ctest","github-actions","template"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mortinger91.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-01-25T15:25:55.000Z","updated_at":"2025-03-13T16:34:59.000Z","dependencies_parsed_at":"2024-08-05T11:15:07.915Z","dependency_job_id":"9b2d6443-5c8c-4c51-8c05-fa41e29b8d6e","html_url":"https://github.com/mortinger91/cpp-cmake-template","commit_stats":null,"previous_names":[],"tags_count":9,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mortinger91%2Fcpp-cmake-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mortinger91%2Fcpp-cmake-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mortinger91%2Fcpp-cmake-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mortinger91%2Fcpp-cmake-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mortinger91","download_url":"https://codeload.github.com/mortinger91/cpp-cmake-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248663991,"owners_count":21141872,"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":["cmake","cpp","ctest","github-actions","template"],"created_at":"2024-11-26T06:42:22.053Z","updated_at":"2025-04-13T04:35:07.800Z","avatar_url":"https://github.com/mortinger91.png","language":"CMake","readme":"[![main](https://github.com/mortinger91/cpp-cmake-template/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/mortinger91/cpp-cmake-template/actions/workflows/main.yml)\n\n# cpp-cmake-template\n\n## Template for a multi-platform C++ CMake project\n\n### Main features:\n- CMake files\n- CTest unit tests framework\n- Github Actions that build and run the tests\n- Scripts and VSCode files for ease of use\n- Dockerfile for building and running the tests in a container\n- Support for compiler cache tools: ccache and sccache\n- Formatting via clang-format (that runs automatically in a git pre-commit hook)\n\n### Requirements:\n- CMake\n- Clang\n- LLDB\n- clang-format\n- *(optional for compiler cache)* ccache\n- *(optional for IDE debugging)* VSCode 'CodeLLDB' extension\n- *(only on Windows)* MSVC compiler \n\n## Instructions\n\n### How to set up the project:\nExecute VSCode task `build_cmake_debug` or run this script:\n    \n    ./projectFolder/scripts/build_cmake_debug.sh\n\nThis needs to run the first time and any time you make  \nchanges to a CMake file or add new source or test files.\n\n### How to build the project:\nExecute VSCode task `build_debug` or run this script:\n    \n    ./projectFolder/scripts/build_debug.sh\n\nTo build for release execute VSCode task `create_release` or run this script:\n\n    ./projectFolder/scripts/create_release.sh\n\nAll the artifacts will be in the build/ directory.\n\n### How to debug the project:\nLaunch VSCode `DEBUG` configuration for IDE debugging.  \nIf you want to debug in the command line run:\n\n    lldb ./build/Debug/bin/cpp-cmake-template\n\n### How to run the tests:\nExecute VSCode task `run_tests` or run this script:\n    \n    ./projectFolder/scripts/run_tests.sh\n\nIf you want to build and run the tests in a fresh Docker container  \nexecute VSCode task `run_tests_in_Docker` or run this script:\n\n    ./projectFolder/scripts/run_tests_in_Docker.sh\n\n### How to add new files to the project:\nAdd any new source file to a `projectFolder/src/dir` directory.  \nYou can create any new `projectFolder/src/dir` directories.  \nAdd any new test file to the `projectFolder/tests` directory.  \nBoth these operations does not require any changes to CMake files.  \n\n__Remember to re-run `build_cmake_debug` after you have added new files or directories.__\n\n### Windows:\nUse the same VSCode tasks listed above or run the scripts in  \nthis directory: `projectFolder/scripts/windows`.\n\n## Possible future improvements:\n\n- Fix Windows built files path\n- Static checker (BASH and cpp)\n- E2E tests (other than just building, also running the binary to see if there are any run-time errors)\n- CMake `install` to install the release build in the system\n- Better support for 3rd parties libraries\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmortinger91%2Fcpp-cmake-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmortinger91%2Fcpp-cmake-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmortinger91%2Fcpp-cmake-template/lists"}