Newer
Older
################################################################################
# Copyright 2018-2021, Barcelona Supercomputing Center (BSC), Spain #
# Copyright 2015-2021, Johannes Gutenberg Universitaet Mainz, Germany #
# #
# This software was partially supported by the #
# EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu). #
# #
# This software was partially supported by the #
# ADA-FS project under the SPPEXA project funded by the DFG. #
# #
# This file is part of GekkoFS. #
# #
# GekkoFS is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# GekkoFS is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with GekkoFS. If not, see <https://www.gnu.org/licenses/>. #
# #
# SPDX-License-Identifier: GPL-3.0-or-later #
################################################################################
include(FetchContent)
# get Catch2
set(FETCHCONTENT_QUIET OFF)
FetchContent_Declare(catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG 255aa5f2afe1a622c97422f65ace6ca915be0d8d # v2.11.3
GIT_SHALLOW ON
GIT_PROGRESS ON
FetchContent_GetProperties(catch2)
FetchContent_Populate(catch2)
message(STATUS "[gkfs] Catch2 source dir: ${catch2_SOURCE_DIR}")
message(STATUS "[gkfs] Catch2 binary dir: ${catch2_BINARY_DIR}")
set(CATCH_BUILD_TESTING OFF CACHE INTERNAL "")
add_subdirectory(${catch2_SOURCE_DIR} ${catch2_BINARY_DIR})
add_subdirectory(helpers)
# create a convenience library with Catch2's main
add_library(catch2_main STATIC)
target_sources(catch2_main PRIVATE catch_main.cpp)
target_link_libraries(catch2_main
Catch2::Catch2
Ramon Nou
committed
# define executables for tests and make them depend on the convenience
# library (and Catch2 transitively) and fmt
add_executable(tests)
target_sources(tests
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/test_example_00.cpp
${CMAKE_CURRENT_LIST_DIR}/test_example_01.cpp
${CMAKE_CURRENT_LIST_DIR}/test_utils_arithmetic.cpp
${CMAKE_CURRENT_LIST_DIR}/test_helpers.cpp
${CMAKE_CURRENT_LIST_DIR}/test_guided_distributor.cpp)
Ramon Nou
committed
distributor
# Catch2's contrib folder includes some helper functions
# to auto-discover Catch tests and register them in CTest
set(CMAKE_MODULE_PATH "${catch2_SOURCE_DIR}/contrib" ${CMAKE_MODULE_PATH})
include(Catch)
PROPERTIES LABELS "unit::all"
)
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/unit
)
endif ()