Use FetchContent to grab latest Catch2 release

The key benefit here is that now we're linking against their CMake
target which makes it easy to change how we depend on Catch2. We
can switch from FetchContent to FindPackage to a git submodule and
never have to change our code because we're depending on Catch2 in
the most flexible way possible.
This commit is contained in:
Chris Thrasher 2021-12-09 19:08:55 -07:00 committed by Lukas Dürrenberger
parent 7364d5b578
commit 0f83e3d266
5 changed files with 13 additions and 11693 deletions

11689
extlibs/headers/catch.hpp vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,16 @@
cmake_minimum_required(VERSION 3.14)
set(SRCROOT "${PROJECT_SOURCE_DIR}/test/src")
include(FetchContent)
FetchContent_Declare(Catch2
GIT_REPOSITORY "https://github.com/catchorg/Catch2.git"
GIT_TAG v2.13.7)
FetchContent_MakeAvailable(Catch2)
add_library(sfml-test-main STATIC "${SRCROOT}/CatchMain.cpp")
target_include_directories(sfml-test-main PUBLIC "${PROJECT_SOURCE_DIR}/extlibs/headers" "${SRCROOT}/TestUtilities")
target_include_directories(sfml-test-main PUBLIC "${SRCROOT}/TestUtilities")
target_link_libraries(sfml-test-main PUBLIC Catch2::Catch2)
target_compile_features(sfml-test-main PRIVATE cxx_std_17)
# System is always built

View File

@ -1,2 +1,2 @@
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
#include <catch2/catch.hpp>

View File

@ -1,6 +1,6 @@
#include <SFML/Network.hpp>
#include <catch.hpp>
#include <catch2/catch.hpp>
#include <limits>
template <typename IntegerType>

View File

@ -6,7 +6,7 @@
#ifndef SFML_TESTUTILITIES_SYSTEM_HPP
#define SFML_TESTUTILITIES_SYSTEM_HPP
#include <catch.hpp>
#include <catch2/catch.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/System/Vector3.hpp>