chore: bump catch to 2.13.6
This commit is contained in:
parent
dfb590ed90
commit
f3d65bdc26
@ -14,7 +14,7 @@ For example, to download Catch2:
|
|||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
catch
|
catch
|
||||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
GIT_TAG v2.13.0
|
GIT_TAG v2.13.6
|
||||||
)
|
)
|
||||||
|
|
||||||
# CMake 3.14+
|
# CMake 3.14+
|
||||||
|
@ -1,13 +1,42 @@
|
|||||||
# Catch
|
# Catch
|
||||||
|
|
||||||
|
|
||||||
Catch and [Catch2] (C++11 only version) are powerful, idomatic testing solutions similar in philosophy to PyTest for Python. To use Catch in a CMake project, there are several options.
|
[Catch2] (C++11 only version) is a powerful, idomatic testing solutions similar in philosophy to PyTest for Python. It supports a wider range of compilers than GTest, and is quick to support new things, like M1 builds on macOS. It also has a smaller but faster twin, [doctest](https://github.com/onqtam/doctest), which is quick to compile but misses features like matchers. To use Catch in a CMake project, there are several options.
|
||||||
|
|
||||||
|
## Configure methods
|
||||||
|
|
||||||
|
Catch has nice CMake support, though to use it, you need the full repo. This could be with submodules or FetchContent. Both the [`extended-project`](https://gitlab.com/CLIUtils/modern-cmake/-/tree/master/examples/extended-project) and [`fetch`](https://gitlab.com/CLIUtils/modern-cmake/-/tree/master/examples/fetch) examples use FetchContent. See [the docs](https://github.com/catchorg/Catch2/blob/v2.x/docs/cmake-integration.md#top).
|
||||||
|
|
||||||
|
## Quick download
|
||||||
|
|
||||||
|
This is likely the simplest method and supports older versions of CMake. You can download the all-in-one header file in one step:
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
add_library(catch_main main.cpp)
|
||||||
|
target_include_directories(catch_main PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
set(url https://github.com/philsquared/Catch/releases/download/v2.13.6/catch.hpp)
|
||||||
|
file(
|
||||||
|
DOWNLOAD ${url} "${CMAKE_CURRENT_BINARY_DIR}/catch.hpp"
|
||||||
|
STATUS status
|
||||||
|
EXPECTED_HASH SHA256=681e7505a50887c9085539e5135794fc8f66d8e5de28eadf13a30978627b0f47)
|
||||||
|
list(GET status 0 error)
|
||||||
|
if(error)
|
||||||
|
message(FATAL_ERROR "Could not download ${url}")
|
||||||
|
endif()
|
||||||
|
target_include_directories(catch_main PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
```
|
||||||
|
|
||||||
|
This will two downloads when Catch 3 is released, as that now requires two files (but you no longer have to write a main.cpp). The `main.cpp` looks like this:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#define CATCH_CONFIG_MAIN
|
||||||
|
#include "catch.hpp"
|
||||||
|
```
|
||||||
|
|
||||||
## Vendoring
|
## Vendoring
|
||||||
|
|
||||||
If you simply drop in the single include release of Catch into your project, this is what you would need to add Catch:
|
If you simply drop in the single include release of Catch into your project, this is what you would need to add Catch:
|
||||||
|
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
# Prepare "Catch" library for other executables
|
# Prepare "Catch" library for other executables
|
||||||
set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/catch)
|
set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/catch)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# GoogleTest
|
# GoogleTest
|
||||||
|
|
||||||
|
GoogleTest and GoogleMock are classic options; personally, I personally would recommend Catch2 instead, as GoogleTest heavily follows the Google development philosophy; it drops old compilers very quickly, it assumes users want to live at HEAD, etc. Adding GoogleMock is also often painful - and you need GoogleMock to get matchers, which are a default feature in Catch2 (but not doctest).
|
||||||
|
|
||||||
## Submodule method (preferred)
|
## Submodule method (preferred)
|
||||||
|
|
||||||
To use this method, just checkout GoogleTest as a submodule:[^1]
|
To use this method, just checkout GoogleTest as a submodule:[^1]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
catch
|
catch
|
||||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
GIT_TAG v2.9.1)
|
GIT_TAG v2.13.6)
|
||||||
FetchContent_MakeAvailable(catch)
|
FetchContent_MakeAvailable(catch)
|
||||||
# Adds Catch2::Catch2
|
# Adds Catch2::Catch2
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ include(CTest)
|
|||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
catch
|
catch
|
||||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
GIT_TAG v2.13.0)
|
GIT_TAG v2.13.6)
|
||||||
|
|
||||||
# CMake 3.14+
|
# CMake 3.14+
|
||||||
FetchContent_MakeAvailable(catch)
|
FetchContent_MakeAvailable(catch)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user