diff options
| author | Vishesh Yadav | 2021-06-27 02:20:17 -0700 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-06-30 00:12:36 +0200 |
| commit | 6f21a3609cea360846a0ca93be55877cca14c86d (patch) | |
| tree | 1ae6badc35663ff19e0516890a648c7361c18772 | |
| parent | bf61a418cbc4d3b430e3d258c5287780944ad505 (diff) | |
| download | catch3-6f21a3609cea360846a0ca93be55877cca14c86d.tar.gz | |
Update CMake doc for automatic test registration
`FetchContent` doesn't include `contrib` directory as part of `CMAKE_MODULE_PATH`. This results into `include(Catch)` to fail. This patch just updates the documentation describing how to do include the path, so the new users don't have to figure this out themselves.
Source: https://github.com/catchorg/Catch2/issues/2103#issuecomment-730626324
| -rw-r--r-- | docs/cmake-integration.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/cmake-integration.md b/docs/cmake-integration.md index 4faa9bda..0414f44c 100644 --- a/docs/cmake-integration.md +++ b/docs/cmake-integration.md @@ -88,6 +88,18 @@ include(Catch) catch_discover_tests(foo) ``` +When using `FetchContent`, `include(Catch)` will fail unless +`CMAKE_MODULE_PATH` is explicitly updated to include the contrib +directory. + +```cmake +# ... FetchContent ... +# +list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib) +include(CTest) +include(Catch) +catch_discover_tests() +``` #### Customization `catch_discover_tests` can be given several extra argumets: |