Allow to use system version of the catch test framework (#549)

This commit is contained in:
Nicholas Guriev 2017-08-17 06:00:30 +04:00 committed by Neil MacIntosh
parent 80aa4b0c54
commit e249f861e3
2 changed files with 16 additions and 11 deletions

View File

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.1.3)
project(GSL CXX)
include(ExternalProject)
find_package(Git REQUIRED)
find_package(Git)
# creates a library GSL which is an interface (header files only)
add_library(GSL INTERFACE)

View File

@ -10,16 +10,21 @@ list(APPEND CATCH_CMAKE_ARGS
"-DNO_SELFTEST=true"
)
# add catch
ExternalProject_Add(
catch
PREFIX ${CMAKE_BINARY_DIR}/catch
GIT_REPOSITORY https://github.com/philsquared/Catch.git
GIT_TAG v1.9.6
CMAKE_ARGS ${CATCH_CMAKE_ARGS}
LOG_DOWNLOAD 1
UPDATE_DISCONNECTED 1
)
if(GIT_FOUND)
# add catch
ExternalProject_Add(
catch
PREFIX ${CMAKE_BINARY_DIR}/catch
GIT_REPOSITORY https://github.com/philsquared/Catch.git
GIT_TAG v1.9.6
CMAKE_ARGS ${CATCH_CMAKE_ARGS}
LOG_DOWNLOAD 1
UPDATE_DISCONNECTED 1
)
else()
# assume catch is installed in a system directory
add_custom_target(catch)
endif()
# this interface adds compile options to how the tests are run
# please try to keep entries ordered =)