{"id":18088167,"url":"https://github.com/claremacrae/approvaltests.cpp.cmakesamples","last_synced_at":"2026-03-19T03:13:18.540Z","repository":{"id":47175711,"uuid":"234956487","full_name":"claremacrae/ApprovalTests.cpp.CMakeSamples","owner":"claremacrae","description":"CMake code for various scenarios, for including in the ApprovalTests.cpp cmake docs","archived":false,"fork":false,"pushed_at":"2024-02-27T19:43:54.000Z","size":202,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T01:45:27.775Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/claremacrae.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":"2020-01-19T19:52:42.000Z","updated_at":"2024-02-19T21:56:40.000Z","dependencies_parsed_at":"2024-02-27T20:43:32.628Z","dependency_job_id":null,"html_url":"https://github.com/claremacrae/ApprovalTests.cpp.CMakeSamples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/claremacrae/ApprovalTests.cpp.CMakeSamples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claremacrae%2FApprovalTests.cpp.CMakeSamples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claremacrae%2FApprovalTests.cpp.CMakeSamples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claremacrae%2FApprovalTests.cpp.CMakeSamples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claremacrae%2FApprovalTests.cpp.CMakeSamples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/claremacrae","download_url":"https://codeload.github.com/claremacrae/ApprovalTests.cpp.CMakeSamples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claremacrae%2FApprovalTests.cpp.CMakeSamples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28549845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T19:56:05.265Z","status":"ssl_error","status_checked_at":"2026-01-18T19:55:54.685Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-31T17:12:01.201Z","updated_at":"2026-01-18T20:33:25.282Z","avatar_url":"https://github.com/claremacrae.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nGENERATED FILE - DO NOT EDIT\nThis file was generated by [MarkdownSnippets](https://github.com/SimonCropp/MarkdownSnippets).\nSource File: /mdsource/README.source.md\nTo change this file edit the source file and then execute ./run_markdown_templates.sh.\n--\u003e\n\n# ApprovalTests.cpp.CMakeSamples\n\n\u003c!-- toc --\u003e\n## Contents\n\n  * [Using ApprovalTests.cpp with CMake](#using-approvaltestscpp-with-cmake)\n    * [add_subdirectory_approvaltests_catch2](#add_subdirectory_approvaltests_catch2)\n    * [fetch_content_approvaltests](#fetch_content_approvaltests)\n    * [fetch_content_approvaltests_catch2](#fetch_content_approvaltests_catch2)\n  * [Using ApprovalTests.cpp with CMake and Conan](#using-approvaltestscpp-with-cmake-and-conan)\n    * [conan_cmake_find_package](#conan_cmake_find_package)\n    * [conan_cmake](#conan_cmake)\n    * [cmake_invoking_conan](#cmake_invoking_conan)\n  * [Using ApprovalTests.cpp with CMake and vcpkg](#using-approvaltestscpp-with-cmake-and-vcpkg)\n    * [vcpkg_cmake](#vcpkg_cmake)\n  * [Developing ApprovalTests.cpp with CMake](#developing-approvaltestscpp-with-cmake)\n    * [dev_approvals](#dev_approvals)\n    * [dev_approvals_fetch_content](#dev_approvals_fetch_content)\u003c!-- endToc --\u003e\n\n[![Build Status](https://github.com/claremacrae/ApprovalTests.cpp.CMakeSamples/workflows/build/badge.svg?branch=main)](https://github.com/claremacrae/ApprovalTests.cpp.CMakeSamples/actions?query=branch%3Amain+workflow%3Abuild)\n\nCMake code for various scenarios, for including in the ApprovalTests.cpp cmake docs, and for copying as templates for new projects.  \n\n## Using ApprovalTests.cpp with CMake\n\n### add_subdirectory_approvaltests_catch2\n\n \u003c!-- include: add_subdirectory_approvaltests_catch2. path: /add_subdirectory_approvaltests_catch2/mdsource/add_subdirectory_approvaltests_catch2.include.md --\u003e\n| Topic        | Detail                                                       |\n| ------------ | ------------------------------------------------------------ |\n| Directory    | [add_subdirectory_approvaltests_catch2](/add_subdirectory_approvaltests_catch2/) |\n| Purpose      | Demo how to build your tests against clones or forks of ApprovalTests.cpp and Catch2.\u003cbr /\u003eThose source code of those dependencies will be included in your IDE, alongside your own source code.\u003cbr /\u003eThis allows you to make edits to the dependent projects. |\n| Dependencies | ApprovalTests.cpp - cloned on your machine\u003cbr /\u003eCatch2 - cloned on your machine |\n| Mechanism    | Uses CMake's [`add_subdirectory()`](https://cmake.org/cmake/help/latest/command/add_subdirectory.html) |\n| More Detail  | See [Use own ApprovalTests.cpp and Catch2 clones](https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/CMakeIntegration.md#use-own-approvaltestscpp-and-catch2-clones) |\n \u003c!-- endInclude --\u003e\n\n### fetch_content_approvaltests\n\n \u003c!-- include: fetch_content_approvaltests. path: /fetch_content_approvaltests/mdsource/fetch_content_approvaltests.include.md --\u003e\n| Topic        | Detail                                                       |\n| ------------ | ------------------------------------------------------------ |\n| Directory    | [fetch_content_approvaltests](/fetch_content_approvaltests/) |\n| Purpose      | Demo how to build your tests using CMake's `FetchContent_Declare` and `FetchContent_MakeAvailable` to clone ApprovalTests.cpp, and use its copy of Catch2.\u003cbr /\u003eThe source code of this dependency will be cloned inside your CMake build space, and will not be shown inside your IDE.\u003cbr /\u003eThis requires at least CMake 3.14. |\n| Dependencies | ApprovalTests.cpp - cloned automatically by CMake\u003cbr /\u003eCatch2 - the version in the ApprovalTests.cpp repo will be used |\n| Mechanism    | Uses CMake's [`FetchContent`](https://cmake.org/cmake/help/latest/module/FetchContent.html) module. |\n| More Detail  | See [Make CMake clone ApprovalTests.cpp](https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/CMakeIntegration.md#make-cmake-clone-approvaltestscpp) |\n \u003c!-- endInclude --\u003e\n\n### fetch_content_approvaltests_catch2\n\n \u003c!-- include: fetch_content_approvaltests_catch2. path: /fetch_content_approvaltests_catch2/mdsource/fetch_content_approvaltests_catch2.include.md --\u003e\n| Topic        | Detail                                                       |\n| ------------ | ------------------------------------------------------------ |\n| Directory    | [fetch_content_approvaltests_catch2](/fetch_content_approvaltests_catch2/) |\n| Purpose      | Demo how to build your tests using CMake's `FetchContent_Declare` and `FetchContent_MakeAvailable` to clone ApprovalTests.cpp and Catch2.\u003cbr /\u003eThe source code of those dependencies will be cloned inside your CMake build space, and will not be shown inside your IDE.\u003cbr /\u003eThis requires at least CMake 3.14. |\n| Dependencies | ApprovalTests.cpp - cloned automatically by CMake\u003cbr /\u003eCatch2 - cloned automatically by CMake |\n| Mechanism    | Uses CMake's [`FetchContent`](https://cmake.org/cmake/help/latest/module/FetchContent.html) module. |\n| More Detail  | See [Make CMake clone ApprovalTests.cpp and Catch2](https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/CMakeIntegration.md#make-cmake-clone-approvaltestscpp-and-catch2) |\n \u003c!-- endInclude --\u003e\n\n## Using ApprovalTests.cpp with CMake and Conan\n\n### conan_cmake_find_package\n\n \u003c!-- include: conan_cmake_find_package. path: /conan_cmake_find_package/mdsource/conan_cmake_find_package.include.md --\u003e\n| Topic        | Detail                                                       |\n| ------------ | ------------------------------------------------------------ |\n| Directory    | [conan_cmake_find_package](/conan_cmake_find_package/)       |\n| Purpose      | Demo how to build your tests using Conan's `cmake_find_package` and optionally `cmake_paths` generators to download single headers for specific releases of ApprovalTests.cpp and Catch2.\u003cbr /\u003eThe released headers of those dependencies will be downloaded inside your CMake build space, and will not be shown inside your IDE. |\n| Dependencies | ApprovalTests.cpp - downloaded automatically by Conan\u003cbr/\u003eCatch2 - downloaded automatically by Conan |\n| Mechanism    | Uses Conan's [`cmake_find_package`](https://docs.conan.io/en/latest/integrations/build_system/cmake/cmake_find_package_generator.html) and (optionally) [`cmake_paths`](https://docs.conan.io/en/latest/integrations/build_system/cmake/cmake_paths_generator.html) generators. |\n| More Detail  | See [Example 1. Using Conan's cmake_find_package and cmake_paths generators](https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/ConanIntegration.md#example-1-using-conans-cmake_find_package-and-cmake_paths-generators) |\n \u003c!-- endInclude --\u003e\n\n### conan_cmake\n\n \u003c!-- include: conan_cmake. path: /conan_cmake/mdsource/conan_cmake.include.md --\u003e\n| Topic        | Detail                                                       |\n| ------------ | ------------------------------------------------------------ |\n| Directory    | [conan_cmake](/conan_cmake/)                                 |\n| Purpose      | Demo how to build your tests using Conan's `cmake`  generator to download single headers for specific releases of ApprovalTests.cpp and Catch2.\u003cbr /\u003eThe released headers of those dependencies will be downloaded inside your CMake build space, and will not be shown inside your IDE. |\n| Dependencies | ApprovalTests.cpp - downloaded automatically by Conan\u003cbr/\u003eCatch2 - downloaded automatically by Conan |\n| Mechanism    | Uses Conan's [`cmake`](https://docs.conan.io/en/latest/integrations/build_system/cmake/cmake_generator.html) generator. |\n| More Detail  | See [Example 2. Using Conan's cmake generator](https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/ConanIntegration.md#example-2-using-conans-cmake-generator) |\n \u003c!-- endInclude --\u003e\n\n### cmake_invoking_conan\n\n \u003c!-- include: cmake_invoking_conan. path: /cmake_invoking_conan/mdsource/cmake_invoking_conan.include.md --\u003e\n| Topic        | Detail                                                       |\n| ------------ | ------------------------------------------------------------ |\n| Directory    | [cmake_invoking_conan](/cmake_invoking_conan/)               |\n| Purpose      | Demo how to build your tests by getting CMake to invoke Conan, to download single headers for specific releases of ApprovalTests.cpp and Catch2.\u003cbr /\u003eThe released headers of those dependencies will be downloaded inside your CMake build space, and will not be shown inside your IDE. |\n| Dependencies | ApprovalTests.cpp - downloaded automatically by CMake invoking Conan\u003cbr/\u003eCatch2 - downloaded automatically by CMake invoking Conan |\n| Mechanism    | Uses the [cmake-conan](https://github.com/conan-io/cmake-conan) CMake module to invoke Conan automatically from within CMake. |\n| More Detail  | See [Example 3. Making CMake invoke Conan](https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/ConanIntegration.md#example-3-making-cmake-invoke-conan) |\n \u003c!-- endInclude --\u003e\n\n## Using ApprovalTests.cpp with CMake and vcpkg\n\n### vcpkg_cmake\n\n \u003c!-- include: vcpkg_cmake. path: /vcpkg_cmake/mdsource/vcpkg_cmake.include.md --\u003e\n| Topic        | Detail                                                       |\n| ------------ | ------------------------------------------------------------ |\n| Directory    | [vcpkg_cmake](/vcpkg_cmake/)                                 |\n| Purpose      | Demo how to build your tests using [vcpkg](https://github.com/microsoft/vcpkg) to obtain Catch2 and ApprovalTests.cpp.\u003cp /\u003eA specific version of vcpkg is cloned automatically by CMake, via `FetchContent()` in the top level CMakeLists.txt, and then built inside your CMake build space.\u003cp /\u003eThe benefit of this approach for obtaining vcpkg is that the project can specify the exact version of vcpkg to use, and obtain it automatically - on all platforms. This keeps both build instructions and CI configurations simple.\u003cp /\u003eThe alternative would be to have to write instructions for developers to say how to manually obtain and build the required vcpkg version - which would be tedious and error-prone.\u003cp /\u003eNote that the first time this is run in any given build space, there is a significant wait for vcpkg to be set up, but subsequent runs are much faster.\u003cp /\u003eIf you have multiple build spaces, vcpkg will be cloned and built multiple times, so this mechanism may be best used when you are only building one or two configurations.|\n| Dependencies | ApprovalTests.cpp - obtained automatically by vcpkg\u003cbr/\u003eCatch2 - obtained automatically by vcpkg |\n| Mechanism    | Uses CMake's `FetchContent()` to obtain and build a specific version of vcpkg inside the build space.\u003cp /\u003eUses vcpkg's [manifest mode](https://vcpkg.readthedocs.io/en/latest/users/manifests/) to specify the dependencies. |\n| More Detail  | See [ApprovalTests.cpp Vcpkg Integration docs](https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/VcpkgIntegration.md#top) - TODO Update that page to add descriptive info for this example|\n \u003c!-- endInclude --\u003e\n\n## Developing ApprovalTests.cpp with CMake\n\n### dev_approvals\n\n \u003c!-- include: dev_approvals. path: /dev_approvals/mdsource/dev_approvals.include.md --\u003e\n| Topic        | Detail                                                       |\n| ------------ | ------------------------------------------------------------ |\n| Directory    | [dev_approvals](/dev_approvals/)                        |\n| Purpose      | Demo how to build the ApprovalTests.cpp project against your clones or forks of all its dependencies.\u003cbr /\u003eThose source code of those dependencies will be included in your IDE, alongside your own source code.\u003cbr /\u003eThis allows you to make edits to the dependent projects. |\n| Dependencies | ApprovalTests.cpp - cloned on your machine\u003cbr /\u003eAll its dependencies also cloned on your machine |\n| Mechanism    | Uses CMake's [`find_package()`](https://cmake.org/cmake/help/latest/command/find_package.html) for finding boost, and [`add_subdirectory()`](https://cmake.org/cmake/help/latest/command/add_subdirectory.html) for everything else. |\n| More Detail  | See [Developing ApprovalTests.cpp with test framework sources](https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/CMakeIntegration.md#developing-approvaltestscpp-with-test-framework-sources) |\n \u003c!-- endInclude --\u003e\n\n### dev_approvals_fetch_content\n\n \u003c!-- include: dev_approvals_fetch_content. path: /dev_approvals_fetch_content/mdsource/dev_approvals_fetch_content.include.md --\u003e\n| Topic        | Detail                                                       |\n| ------------ | ------------------------------------------------------------ |\n| Directory    | [dev_approvals_fetch_content](/dev_approvals_fetch_content/)                        |\n| Purpose      | Demo how to build the ApprovalTests.cpp project using CMake's `FetchContent_Declare` and `FetchContent_MakeAvailable` to clone its dependencies.\u003cbr /\u003eThe source code of the dependencies will be cloned inside your CMake build space, and will not be shown inside your IDE.\u003cbr /\u003eThis requires at least CMake 3.14. |\n| Dependencies | ApprovalTests.cpp - cloned on your machine\u003cbr /\u003eAll its dependencies also cloned on your machine, inside each build space |\n| Mechanism    | Uses CMake's [`FetchContent`](https://cmake.org/cmake/help/latest/module/FetchContent.html) module. |\n| More Detail  |  |\n \u003c!-- endInclude --\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaremacrae%2Fapprovaltests.cpp.cmakesamples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclaremacrae%2Fapprovaltests.cpp.cmakesamples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaremacrae%2Fapprovaltests.cpp.cmakesamples/lists"}