Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/documentation cleanup #228

Merged
merged 4 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/relnotes_x.y.z.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
44 changes: 39 additions & 5 deletions doc/CMakeIntegration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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?

Expand Down Expand Up @@ -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
Expand All @@ -250,11 +254,41 @@ 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:

```
your_project/
.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).

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:

Expand Down
3 changes: 2 additions & 1 deletion doc/sphinx/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ Build Systems

* **Integrations**:
:doc:`CMake <generated_docs/CMakeIntegration>` |
:doc:`Conan <generated_docs/ConanIntegration>`
:doc:`Conan <generated_docs/ConanIntegration>` |
:doc:`Vcpkg <generated_docs/VcpkgIntegration>`

* **Your builds**:
:doc:`Build Machines and CI servers <generated_docs/BuildMachinesAndCI>`
Expand Down
3 changes: 2 additions & 1 deletion mdsnippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"Exclude Heading2"
],
"WriteHeader": false,
"Convention": "InPlaceOverwrite"
"Convention": "InPlaceOverwrite",
"UrlAsSnippets": [ "https://raw.githubusercontent.com/Laguna1989/OpenALpp/master/ext/CMakeLists.txt" ]
}
Loading