diff options
author | David Seifert <soap@gentoo.org> | 2018-01-28 13:24:28 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2018-01-29 17:50:01 +0100 |
commit | 7988a78fc3c62ca18a9ade9f440de69164b0fb54 (patch) | |
tree | 20161e38baf84f611bed70cb6e2d0c331d7c3596 /CMakeLists.txt | |
parent | f6e999ff3a68993a9f19f2218b59d626e794395b (diff) | |
download | libnitrokey-7988a78fc3c62ca18a9ade9f440de69164b0fb54.tar.gz libnitrokey-7988a78fc3c62ca18a9ade9f440de69164b0fb54.tar.bz2 |
Try to use system Catch2 if possible
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 14 |
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() |