mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Merge pull request #2643 from kisielk/patch-1
cmake-integration.md: Use "tests" as test target name in all examples.
This commit is contained in:
commit
27ba26f743
@ -90,12 +90,12 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
project(baz LANGUAGES CXX VERSION 0.0.1)
|
project(baz LANGUAGES CXX VERSION 0.0.1)
|
||||||
|
|
||||||
find_package(Catch2 REQUIRED)
|
find_package(Catch2 REQUIRED)
|
||||||
add_executable(foo test.cpp)
|
add_executable(tests test.cpp)
|
||||||
target_link_libraries(foo PRIVATE Catch2::Catch2)
|
target_link_libraries(tests PRIVATE Catch2::Catch2)
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(Catch)
|
include(Catch)
|
||||||
catch_discover_tests(foo)
|
catch_discover_tests(tests)
|
||||||
```
|
```
|
||||||
|
|
||||||
When using `FetchContent`, `include(Catch)` will fail unless
|
When using `FetchContent`, `include(Catch)` will fail unless
|
||||||
@ -108,7 +108,7 @@ directory.
|
|||||||
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(Catch)
|
include(Catch)
|
||||||
catch_discover_tests()
|
catch_discover_tests(tests)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Customization
|
#### Customization
|
||||||
@ -222,12 +222,12 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
project(baz LANGUAGES CXX VERSION 0.0.1)
|
project(baz LANGUAGES CXX VERSION 0.0.1)
|
||||||
|
|
||||||
find_package(Catch2 REQUIRED)
|
find_package(Catch2 REQUIRED)
|
||||||
add_executable(foo test.cpp)
|
add_executable(tests test.cpp)
|
||||||
target_link_libraries(foo PRIVATE Catch2::Catch2)
|
target_link_libraries(tests PRIVATE Catch2::Catch2)
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(ParseAndAddCatchTests)
|
include(ParseAndAddCatchTests)
|
||||||
ParseAndAddCatchTests(foo)
|
ParseAndAddCatchTests(tests)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user