From 0465fd1048d0bd954880cbdda0fadc89284bd324 Mon Sep 17 00:00:00 2001 From: Simon Weis Date: Tue, 27 Feb 2024 18:16:49 +0100 Subject: [PATCH 1/4] . d add Vcpkg to top level file on read the docs --- doc/sphinx/index.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/sphinx/index.rst b/doc/sphinx/index.rst index 751a20ce..abc0bfc4 100644 --- a/doc/sphinx/index.rst +++ b/doc/sphinx/index.rst @@ -183,7 +183,8 @@ Build Systems * **Integrations**: :doc:`CMake ` | - :doc:`Conan ` + :doc:`Conan ` | + :doc:`Vcpkg ` * **Your builds**: :doc:`Build Machines and CI servers ` From 47f9edd24509a0de4cb40c867d9113c210a8e82c Mon Sep 17 00:00:00 2001 From: Simon Weis Date: Tue, 27 Feb 2024 18:55:00 +0100 Subject: [PATCH 2/4] . d Add documentation for CPM integration Fixes #185 --- doc/CMakeIntegration.md | 42 +++++++++++++++++++++++++++++++++++++---- mdsnippets.json | 3 ++- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/doc/CMakeIntegration.md b/doc/CMakeIntegration.md index c4874781..f08282af 100644 --- a/doc/CMakeIntegration.md +++ b/doc/CMakeIntegration.md @@ -71,7 +71,7 @@ Note that these are always enabled if this is the top-level project. Note that these are always included if this is the top-level project. * `APPROVAL_TESTS_BUILD_THIRD_PARTY_CATCH2` - * When `ON`, this project's copy of the Catch2 test framework is included. Defaults to `OFF`. + * When `ON`, this project's copy of the Catch2v2 test framework is included. Defaults to `OFF`. * `APPROVAL_TESTS_BUILD_THIRD_PARTY_DOCTEST` * When `ON`, this project's copy of the doctest test framework is included. Defaults to `OFF`. * `APPROVAL_TESTS_BUILD_THIRD_PARTY_UT` @@ -98,6 +98,10 @@ Note that these are always included if this is the top-level project. * **Use case:** This is typically for when you want CMake to download a specific version of Approval Tests for you, behind the scenes, and you are using an older version of CMake. * `find_package()` - not supported * There is not yet support for [`find_package()`](https://cmake.org/cmake/help/latest/command/find_package.html). +* `CPM` + * See [Make CMake clone ApprovalTests.cpp using CPM](/doc/CMakeIntegration.md#make-cmake-clone-approvaltestscpp-using-cpm) + * [CPM](https://github.com/cpm-cmake/CPM.cmake) is CMake's missing package manager. It is a small script for setup-free, cross-platform, reproducible dependency management. + * **Use case:** This is typically for when you want CMake to download a specific version of Approval Tests for you, behind the scenes, and you would like caching, offline builds and version checking. ### Single header or CMake Integration? @@ -236,9 +240,9 @@ fetch_content_approvaltests_catch2/ .git/ cmake-build-debug/ _deps/ -     approvaltests-build/ -      approvaltests-src/ -      approvaltests-subbuild/ + approvaltests-build/ + approvaltests-src/ + approvaltests-subbuild/ catch2-build catch2-src catch2-subbuild @@ -250,6 +254,36 @@ fetch_content_approvaltests_catch2/ ... ``` +#### Make CMake clone ApprovalTests.cpp using CPM + +The following is for when you just want ApprovalTests.cpp to be downloaded as part of your project's build. You don't particularly want to see their source code, although you're happy if your debugger steps in to them. + +It also needs CMake 3.14 or above. + +We use this in our `CMakeLists.txt` file: + +snippet: cpm_download + +snippet: cpm_add_approvaltests + +Note the `GIT_TAG` values: This tells CMake which revision of dependencies to use. The value can be a tag or a git commit ID. Here we use `master`. However, it is generally recommended to pin your dependencies to specific versions, and test behaviour before updating to newer versions. + +After CMake has generated the build files, the directory structure would look something like this, where the `cmake-build-debug` directory is the build space, and the `cmake-build-debug/_deps` contains the downloaded and built ApprovalTests.cpp repository: + +``` +fetch_content_approvaltests_catch2/ + .git/ + cmake-build-debug/ + _deps/ + approvaltests-build/ + approvaltests-src/ + approvaltests-subbuild/ + ... + CMakeLists.txt + tests/ + ... +``` + #### Make CMake clone ApprovalTests.cpp **Note:** The files in this section can be viewed and downloaded from [fetch_content_approvaltests](https://github.com/claremacrae/ApprovalTests.cpp.CMakeSamples/tree/main/fetch_content_approvaltests). diff --git a/mdsnippets.json b/mdsnippets.json index c9de7d80..f8477890 100644 --- a/mdsnippets.json +++ b/mdsnippets.json @@ -12,5 +12,6 @@ "Exclude Heading2" ], "WriteHeader": false, - "Convention": "InPlaceOverwrite" + "Convention": "InPlaceOverwrite", + "UrlAsSnippets": [ "https://raw.githubusercontent.com/Laguna1989/OpenALpp/master/ext/CMakeLists.txt" ] } From 601c0ec7a813eb4a348e092289754f2d2da8e265 Mon Sep 17 00:00:00 2001 From: Simon Weis Date: Tue, 27 Feb 2024 19:04:22 +0100 Subject: [PATCH 3/4] . d update catch2 to catch2v2 in documentation where appropriate Fixes #185 --- doc/CMakeIntegration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/CMakeIntegration.md b/doc/CMakeIntegration.md index f08282af..3411488c 100644 --- a/doc/CMakeIntegration.md +++ b/doc/CMakeIntegration.md @@ -271,7 +271,7 @@ Note the `GIT_TAG` values: This tells CMake which revision of dependencies to us After CMake has generated the build files, the directory structure would look something like this, where the `cmake-build-debug` directory is the build space, and the `cmake-build-debug/_deps` contains the downloaded and built ApprovalTests.cpp repository: ``` -fetch_content_approvaltests_catch2/ +your_project/ .git/ cmake-build-debug/ _deps/ @@ -288,7 +288,7 @@ fetch_content_approvaltests_catch2/ **Note:** The files in this section can be viewed and downloaded from [fetch_content_approvaltests](https://github.com/claremacrae/ApprovalTests.cpp.CMakeSamples/tree/main/fetch_content_approvaltests). -The only difference between the previous example and this one is that here we use the Catch2 header that is in the ApprovalTests.cpp project. +The only difference between the previous example and this one is that here we use the Catch2v2 header that is in the ApprovalTests.cpp project. We use this `dependencies/CMakeLists.txt` file: From 19e8ba9aacc6f4f24b59e00a5adcd2f3154f7a6a Mon Sep 17 00:00:00 2001 From: Simon Weis Date: Tue, 27 Feb 2024 19:17:08 +0100 Subject: [PATCH 4/4] . d add a first point to the release notes --- build/relnotes_x.y.z.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/relnotes_x.y.z.md b/build/relnotes_x.y.z.md index 20478daa..fae4c657 100644 --- a/build/relnotes_x.y.z.md +++ b/build/relnotes_x.y.z.md @@ -7,4 +7,4 @@ * **Bug fixes** * None * **Other changes** - * None + * TODO CMake library target changed: Linking against the included catch2v2. (only if people want to use the bundled catch2. If they bring their own, no change is needed)