Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/claremacrae/approvaltests.cpp.cmakesamples
CMake code for various scenarios, for including in the ApprovalTests.cpp cmake docs
https://github.com/claremacrae/approvaltests.cpp.cmakesamples
Last synced: about 1 month ago
JSON representation
CMake code for various scenarios, for including in the ApprovalTests.cpp cmake docs
- Host: GitHub
- URL: https://github.com/claremacrae/approvaltests.cpp.cmakesamples
- Owner: claremacrae
- Created: 2020-01-19T19:52:42.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-02-27T19:43:54.000Z (11 months ago)
- Last Synced: 2024-10-31T17:12:28.454Z (3 months ago)
- Language: CMake
- Size: 197 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ApprovalTests.cpp.CMakeSamples
## Contents
* [Using ApprovalTests.cpp with CMake](#using-approvaltestscpp-with-cmake)
* [add_subdirectory_approvaltests_catch2](#add_subdirectory_approvaltests_catch2)
* [fetch_content_approvaltests](#fetch_content_approvaltests)
* [fetch_content_approvaltests_catch2](#fetch_content_approvaltests_catch2)
* [Using ApprovalTests.cpp with CMake and Conan](#using-approvaltestscpp-with-cmake-and-conan)
* [conan_cmake_find_package](#conan_cmake_find_package)
* [conan_cmake](#conan_cmake)
* [cmake_invoking_conan](#cmake_invoking_conan)
* [Using ApprovalTests.cpp with CMake and vcpkg](#using-approvaltestscpp-with-cmake-and-vcpkg)
* [vcpkg_cmake](#vcpkg_cmake)
* [Developing ApprovalTests.cpp with CMake](#developing-approvaltestscpp-with-cmake)
* [dev_approvals](#dev_approvals)
* [dev_approvals_fetch_content](#dev_approvals_fetch_content)[![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)
CMake code for various scenarios, for including in the ApprovalTests.cpp cmake docs, and for copying as templates for new projects.
## Using ApprovalTests.cpp with CMake
### add_subdirectory_approvaltests_catch2
| Topic | Detail |
| ------------ | ------------------------------------------------------------ |
| Directory | [add_subdirectory_approvaltests_catch2](/add_subdirectory_approvaltests_catch2/) |
| Purpose | Demo how to build your tests against clones or forks of ApprovalTests.cpp and Catch2.
Those source code of those dependencies will be included in your IDE, alongside your own source code.
This allows you to make edits to the dependent projects. |
| Dependencies | ApprovalTests.cpp - cloned on your machine
Catch2 - cloned on your machine |
| Mechanism | Uses CMake's [`add_subdirectory()`](https://cmake.org/cmake/help/latest/command/add_subdirectory.html) |
| 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) |
### fetch_content_approvaltests
| Topic | Detail |
| ------------ | ------------------------------------------------------------ |
| Directory | [fetch_content_approvaltests](/fetch_content_approvaltests/) |
| 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.
The source code of this dependency will be cloned inside your CMake build space, and will not be shown inside your IDE.
This requires at least CMake 3.14. |
| Dependencies | ApprovalTests.cpp - cloned automatically by CMake
Catch2 - the version in the ApprovalTests.cpp repo will be used |
| Mechanism | Uses CMake's [`FetchContent`](https://cmake.org/cmake/help/latest/module/FetchContent.html) module. |
| More Detail | See [Make CMake clone ApprovalTests.cpp](https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/CMakeIntegration.md#make-cmake-clone-approvaltestscpp) |
### fetch_content_approvaltests_catch2
| Topic | Detail |
| ------------ | ------------------------------------------------------------ |
| Directory | [fetch_content_approvaltests_catch2](/fetch_content_approvaltests_catch2/) |
| Purpose | Demo how to build your tests using CMake's `FetchContent_Declare` and `FetchContent_MakeAvailable` to clone ApprovalTests.cpp and Catch2.
The source code of those dependencies will be cloned inside your CMake build space, and will not be shown inside your IDE.
This requires at least CMake 3.14. |
| Dependencies | ApprovalTests.cpp - cloned automatically by CMake
Catch2 - cloned automatically by CMake |
| Mechanism | Uses CMake's [`FetchContent`](https://cmake.org/cmake/help/latest/module/FetchContent.html) module. |
| 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) |
## Using ApprovalTests.cpp with CMake and Conan
### conan_cmake_find_package
| Topic | Detail |
| ------------ | ------------------------------------------------------------ |
| Directory | [conan_cmake_find_package](/conan_cmake_find_package/) |
| 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.
The released headers of those dependencies will be downloaded inside your CMake build space, and will not be shown inside your IDE. |
| Dependencies | ApprovalTests.cpp - downloaded automatically by Conan
Catch2 - downloaded automatically by Conan |
| 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. |
| 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) |
### conan_cmake
| Topic | Detail |
| ------------ | ------------------------------------------------------------ |
| Directory | [conan_cmake](/conan_cmake/) |
| Purpose | Demo how to build your tests using Conan's `cmake` generator to download single headers for specific releases of ApprovalTests.cpp and Catch2.
The released headers of those dependencies will be downloaded inside your CMake build space, and will not be shown inside your IDE. |
| Dependencies | ApprovalTests.cpp - downloaded automatically by Conan
Catch2 - downloaded automatically by Conan |
| Mechanism | Uses Conan's [`cmake`](https://docs.conan.io/en/latest/integrations/build_system/cmake/cmake_generator.html) generator. |
| 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) |
### cmake_invoking_conan
| Topic | Detail |
| ------------ | ------------------------------------------------------------ |
| Directory | [cmake_invoking_conan](/cmake_invoking_conan/) |
| 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.
The released headers of those dependencies will be downloaded inside your CMake build space, and will not be shown inside your IDE. |
| Dependencies | ApprovalTests.cpp - downloaded automatically by CMake invoking Conan
Catch2 - downloaded automatically by CMake invoking Conan |
| Mechanism | Uses the [cmake-conan](https://github.com/conan-io/cmake-conan) CMake module to invoke Conan automatically from within CMake. |
| 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) |
## Using ApprovalTests.cpp with CMake and vcpkg
### vcpkg_cmake
A 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.The 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.The 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.Note 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.If 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.|
| Topic | Detail |
| ------------ | ------------------------------------------------------------ |
| Directory | [vcpkg_cmake](/vcpkg_cmake/) |
| Purpose | Demo how to build your tests using [vcpkg](https://github.com/microsoft/vcpkg) to obtain Catch2 and ApprovalTests.cpp.
| Dependencies | ApprovalTests.cpp - obtained automatically by vcpkg
Catch2 - obtained automatically by vcpkg |
| Mechanism | Uses CMake's `FetchContent()` to obtain and build a specific version of vcpkg inside the build space.Uses vcpkg's [manifest mode](https://vcpkg.readthedocs.io/en/latest/users/manifests/) to specify the dependencies. |
| 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|
## Developing ApprovalTests.cpp with CMake
### dev_approvals
| Topic | Detail |
| ------------ | ------------------------------------------------------------ |
| Directory | [dev_approvals](/dev_approvals/) |
| Purpose | Demo how to build the ApprovalTests.cpp project against your clones or forks of all its dependencies.
Those source code of those dependencies will be included in your IDE, alongside your own source code.
This allows you to make edits to the dependent projects. |
| Dependencies | ApprovalTests.cpp - cloned on your machine
All its dependencies also cloned on your machine |
| 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. |
| 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) |
### dev_approvals_fetch_content
| Topic | Detail |
| ------------ | ------------------------------------------------------------ |
| Directory | [dev_approvals_fetch_content](/dev_approvals_fetch_content/) |
| Purpose | Demo how to build the ApprovalTests.cpp project using CMake's `FetchContent_Declare` and `FetchContent_MakeAvailable` to clone its dependencies.
The source code of the dependencies will be cloned inside your CMake build space, and will not be shown inside your IDE.
This requires at least CMake 3.14. |
| Dependencies | ApprovalTests.cpp - cloned on your machine
All its dependencies also cloned on your machine, inside each build space |
| Mechanism | Uses CMake's [`FetchContent`](https://cmake.org/cmake/help/latest/module/FetchContent.html) module. |
| More Detail | |