aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Guriev <guriev-ns@ya.ru>2017-08-17 06:00:30 +0400
committerNeil MacIntosh <neilmac@microsoft.com>2017-08-16 19:00:30 -0700
commite249f861e3a77d1d4b754d2394c6f98065d8fa86 (patch)
tree01f8bfbc8f63948eb0c3af63c227c64e1facde83
parent80aa4b0c54744579a0bb74ef1b607fc03378d78d (diff)
downloadMicrosoft-GSL-e249f861e3a77d1d4b754d2394c6f98065d8fa86.tar.gz
Allow to use system version of the catch test framework (#549)
-rw-r--r--CMakeLists.txt2
-rw-r--r--tests/CMakeLists.txt25
2 files changed, 16 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e62a1d6..986d948 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a142174..ea456c7 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -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 =)