cppzmq/tests/cmake/catch.cmake
Pawel Kurdybacha 6982fb7017 Problem #268: CTest output without tests details
Solution: Added integration with CTest to existing unit test framework
based on Catch. ctest -v returns list of run tests now.

Changes:

* downloading and using Catch cmake modules that `unit_tests
--list-test-names-only` for add_test internally
2019-01-23 08:48:11 +00:00

28 lines
934 B
CMake

include(ExternalProject)
ExternalProject_Add(
catch
PREFIX ${CMAKE_BINARY_DIR}/catch
URL "https://raw.githubusercontent.com/catchorg/Catch2/Catch1.x/single_include/catch.hpp"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
DOWNLOAD_NO_EXTRACT ON
)
# Expose variable CATCH_MODULE_PATH to parent scope
ExternalProject_Get_Property(catch DOWNLOAD_DIR)
set(CATCH_MODULE_PATH ${DOWNLOAD_DIR} CACHE INTERNAL "Path to include catch")
# Download module for CTest integration
if(NOT EXISTS "${CATCH_MODULE_PATH}/Catch.cmake")
file(DOWNLOAD "https://raw.githubusercontent.com/catchorg/Catch2/master/contrib/Catch.cmake"
"${CATCH_MODULE_PATH}/Catch.cmake")
endif()
if(NOT EXISTS "${CATCH_MODULE_PATH}/CatchAddTests.cmake")
file(DOWNLOAD "https://raw.githubusercontent.com/catchorg/Catch2/master/contrib/CatchAddTests.cmake"
"${CATCH_MODULE_PATH}/CatchAddTests.cmake")
endif()