From 7988a78fc3c62ca18a9ade9f440de69164b0fb54 Mon Sep 17 00:00:00 2001 From: David Seifert Date: Sun, 28 Jan 2018 13:24:28 +0100 Subject: Try to use system Catch2 if possible --- CMakeLists.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index c494dbf..360c391 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,7 +127,19 @@ OPTION(COMPILE_TESTS "Compile tests" FALSE) OPTION(COMPILE_OFFLINE_TESTS "Compile offline tests" FALSE) IF(COMPILE_OFFLINE_TESTS OR COMPILE_TESTS) - include_directories(unittest/Catch/include) + find_package(PkgConfig) + IF(PKG_CONFIG_FOUND) + pkg_check_modules(CATCH2 catch) + ENDIF() + + if (CATCH2_FOUND) + message(STATUS "Found system Catch2, not using bundled version") + add_compile_options(${CATCH2_CFLAGS}) + ELSE() + message(STATUS "Did NOT find system Catch2, instead using bundled version") + include_directories(unittest/Catch/single_include) + ENDIF() + add_library(catch STATIC unittest/catch_main.cpp ) ENDIF() -- cgit v1.2.1