summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Seifert <soap@gentoo.org>2018-01-28 13:24:28 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2018-01-29 17:50:01 +0100
commit7988a78fc3c62ca18a9ade9f440de69164b0fb54 (patch)
tree20161e38baf84f611bed70cb6e2d0c331d7c3596
parentf6e999ff3a68993a9f19f2218b59d626e794395b (diff)
downloadlibnitrokey-7988a78fc3c62ca18a9ade9f440de69164b0fb54.tar.gz
libnitrokey-7988a78fc3c62ca18a9ade9f440de69164b0fb54.tar.bz2
Try to use system Catch2 if possible
-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()