Skip to content

Update Catch2 dependency to latest release #64

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
30 changes: 3 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,42 +74,18 @@ if (OPTIONAL_BUILD_TESTS)
set(CATCH_BUILD_TESTING OFF)
set(CATCH_INSTALL_DOCS OFF)
FetchContent_Declare(Catch2 URL
https://github.com/catchorg/Catch2/archive/v2.9.2.zip)
https://github.com/catchorg/Catch2/archive/v3.6.0.zip)
FetchContent_MakeAvailable(Catch2)

file(GENERATE OUTPUT catch.main.cpp
CONTENT [[
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
]])
set_property(SOURCE ${PROJECT_BINARY_DIR}/catch.main.cpp
PROPERTY
GENERATED ON)
add_library(${PROJECT_NAME}-catch-main OBJECT)
target_sources(${PROJECT_NAME}-catch-main PRIVATE
${PROJECT_BINARY_DIR}/catch.main.cpp)
target_compile_options(${PROJECT_NAME}-catch-main
PUBLIC
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<BOOL:"$ENV{TRAVIS}">>:-stdlib=libc++>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra>)
target_link_options(${PROJECT_NAME}-catch-main
PUBLIC
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<BOOL:"$ENV{TRAVIS}">>:-stdlib=libc++>)
target_link_libraries(${PROJECT_NAME}-catch-main
PUBLIC
Catch2::Catch2
optional)

file(GLOB test-sources CONFIGURE_DEPENDS tests/*.cpp)
foreach (source IN LISTS test-sources)
get_filename_component(name "${source}" NAME_WE)
set(test "${PROJECT_NAME}-test-${name}")
add_executable(${test}
"${source}"
$<TARGET_OBJECTS:${PROJECT_NAME}-catch-main>)
"${source}")
target_link_libraries(${test}
PRIVATE
${PROJECT_NAME}-catch-main)
Catch2::Catch2WithMain optional)
add_test(NAME ${PROJECT_NAME}::test::${name} COMMAND ${test})
endforeach()
endif()
Expand Down
2 changes: 1 addition & 1 deletion tests/assignment.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

TEST_CASE("Assignment value", "[assignment.value]") {
Expand Down
2 changes: 1 addition & 1 deletion tests/bases.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

// Old versions of GCC don't have the correct trait names. Could fix them up if needs be.
Expand Down
2 changes: 1 addition & 1 deletion tests/constexpr.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

TEST_CASE("Constexpr", "[constexpr]") {
Expand Down
2 changes: 1 addition & 1 deletion tests/constructors.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion tests/emplace.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>
#include <utility>
#include <tuple>
Expand Down
2 changes: 1 addition & 1 deletion tests/extensions.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>
#include <string>

Expand Down
2 changes: 1 addition & 1 deletion tests/hash.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

TEST_CASE("Hashing", "[hash]") {}
2 changes: 1 addition & 1 deletion tests/in_place.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

#include <tuple>
Expand Down
2 changes: 1 addition & 1 deletion tests/issues.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>
#include <type_traits>

Expand Down
2 changes: 1 addition & 1 deletion tests/make_optional.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

#include <tuple>
Expand Down
2 changes: 1 addition & 1 deletion tests/noexcept.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

TEST_CASE("Noexcept", "[noexcept]") {
Expand Down
2 changes: 1 addition & 1 deletion tests/nullopt.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

TEST_CASE("Nullopt", "[nullopt]") {
Expand Down
2 changes: 1 addition & 1 deletion tests/observers.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

struct move_detector {
Expand Down
2 changes: 1 addition & 1 deletion tests/relops.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

TEST_CASE("Relational ops", "[relops]") {
Expand Down
2 changes: 1 addition & 1 deletion tests/swap.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <tl/optional.hpp>

TEST_CASE("Swap value", "[swap.value]") {
Expand Down