mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
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
This commit is contained in:
parent
bf61a418cb
commit
6f21a3609c
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user