diff options
| author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-10-10 18:48:44 +0200 | 
|---|---|---|
| committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-10-10 18:48:44 +0200 | 
| commit | d7b408f96f196fcd03f90131a3dbcbb1f11a0728 (patch) | |
| tree | da98c5540320edc9064a8d9e6d9d7722085b8ac7 | |
| parent | bb7e087979d9150b8ab8d28ffccc43a3eaddab35 (diff) | |
| download | libnitrokey-d7b408f96f196fcd03f90131a3dbcbb1f11a0728.tar.gz libnitrokey-d7b408f96f196fcd03f90131a3dbcbb1f11a0728.tar.bz2 | |
Allow to enable compilation of general and offline tests separately
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| -rw-r--r-- | CMakeLists.txt | 23 | 
1 files changed, 14 insertions, 9 deletions
| diff --git a/CMakeLists.txt b/CMakeLists.txt index 246edbd..643e630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,6 @@ include(GNUInstallDirs)  OPTION(LIBNITROKEY_STATIC "Build libnitrokey statically" FALSE) -OPTION(COMPILE_TESTS "Compile tests" FALSE)  IF (NOT CMAKE_BUILD_TYPE)      set(CMAKE_BUILD_TYPE RelWithDebInfo)  ENDIF() @@ -124,14 +123,21 @@ file(GLOB LIB_INCLUDES "include/*.h")  install (FILES ${LIB_INCLUDES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libnitrokey)  install (TARGETS ${LIBNAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) +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) +    add_library(catch SHARED unittest/catch_main.cpp ) +ENDIF() -include_directories(unittest/Catch/include) -add_library(catch STATIC unittest/catch_main.cpp ) -add_executable (test_offline unittest/test_offline.cc) -target_link_libraries (test_offline ${EXTRA_LIBS} ${LIBNAME}-log catch) -#run with 'make test' or 'ctest' -include (CTest) -add_test (runs test_offline) +IF(COMPILE_OFFLINE_TESTS) +    add_executable (test_offline unittest/test_offline.cc) +    target_link_libraries (test_offline ${EXTRA_LIBS} ${LIBNAME} catch) +    #run with 'make test' or 'ctest' +    include (CTest) +    add_test (runs test_offline) +ENDIF()  IF (COMPILE_TESTS)      #needs connected PRO device for success @@ -158,7 +164,6 @@ ENDIF() -  #SET(CPACK_GENERATOR  #        "DEB;RPM")  # build a CPack driven installer package | 
