aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2018-01-29 18:03:36 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2018-01-29 18:03:36 +0100
commitf5235ca6cff56b7561901d311f6bd65aa2615ffb (patch)
tree20161e38baf84f611bed70cb6e2d0c331d7c3596
parentf6e999ff3a68993a9f19f2218b59d626e794395b (diff)
parent7988a78fc3c62ca18a9ade9f440de69164b0fb54 (diff)
downloadlibnitrokey-f5235ca6cff56b7561901d311f6bd65aa2615ffb.tar.gz
libnitrokey-f5235ca6cff56b7561901d311f6bd65aa2615ffb.tar.bz2
Merge branch 'pr_90'
Adding support for Catch2 if available in system
-rw-r--r--CMakeLists.txt14
1 files changed, 13 insertions, 1 deletions
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()