Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
Catch2: move to submodule and update to v2.13.8 (#386)
Browse files Browse the repository at this point in the history
* add another `EXTERNAL_CATCH2` option to be able to use system installations.
* turn on Catch2 test discovery when using submodule
  • Loading branch information
matz-e authored Feb 18, 2022
1 parent ae0c9eb commit 2b6fa15
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 13,929 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "3rdparty/lexertl14"]
path = 3rdparty/lexertl14
url = https://github.com/BenHanson/lexertl14
[submodule "3rdparty/Catch2"]
path = 3rdparty/Catch2
url = https://github.com/catchorg/Catch2.git
1 change: 1 addition & 0 deletions 3rdparty/Catch2
Submodule Catch2 added at 216713
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set(CMAKE_VERBOSE_MAKEFILE ON)

option(BUILD_BINDINGS "Build the python bindings" ON)
option(MorphIO_CXX_WARNINGS "Compile C++ with warnings" ON)
option(EXTERNAL_CATCH2 "Use Catch2 from external source" OFF)
option(EXTERNAL_HIGHFIVE "Use HighFive from external source" OFF)
option(EXTERNAL_PYBIND11 "Use pybind11 from external source" OFF)
option(MORPHIO_TESTS "Build tests" ON)
Expand Down Expand Up @@ -65,5 +66,11 @@ install(

if (MORPHIO_TESTS)
enable_testing()
if (EXTERNAL_CATCH2)
find_package(Catch2 REQUIRED)
else()
add_subdirectory(3rdparty/Catch2)
include(3rdparty/Catch2/contrib/Catch.cmake)
endif()
add_subdirectory(tests)
endif()
11 changes: 9 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(TESTS_SRC
test_mutable_morphology.cpp
test_vasculature_morphology.cpp
)
set(TESTS_LINK_LIBRAIRIES morphio_static HighFive)
set(TESTS_LINK_LIBRAIRIES morphio_static HighFive Catch2::Catch2)

if(APPLE)
add_definitions("-DLIBCXX_INSTALL_FILESYSTEM_LIBRARY=YES")
Expand Down Expand Up @@ -36,10 +36,17 @@ if (MORPHIO_ENABLE_COVERAGE)
endif()

target_link_libraries(unittests
PRIVATE ${TESTS_LINK_LIBRAIRIES}
PRIVATE
${TESTS_LINK_LIBRAIRIES}
)

add_test(NAME unittests
COMMAND unittests
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
)

if (NOT EXTERNAL_CATCH2)
catch_discover_tests( unittests
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
)
endif()
Loading

0 comments on commit 2b6fa15

Please sign in to comment.