diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-02-06 09:25:03 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-03-11 15:41:42 +0100 |
commit | fa02c23ee2f4bef6be8a502e11fc568dc74b4235 (patch) | |
tree | cce0b71b3404a6d64628424276950e51f09ae124 | |
parent | b16667ba57ef301ef961801676de66cce30d4c52 (diff) | |
download | libnitrokey-fa02c23ee2f4bef6be8a502e11fc568dc74b4235.tar.gz libnitrokey-fa02c23ee2f4bef6be8a502e11fc568dc74b4235.tar.bz2 |
Use CMake instead of Make
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r-- | CMakeLists.txt | 23 | ||||
-rw-r--r-- | unittest/test.cc | 1 | ||||
-rw-r--r-- | unittest/test2.cc | 1 | ||||
-rw-r--r-- | unittest/test3.cc | 5 | ||||
-rw-r--r-- | unittest/test_HOTP.cc | 3 |
5 files changed, 19 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c324067..aa6208e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,12 +29,25 @@ set(SOURCE_FILES misc.cc NitrokeyManager.cc NK_C_API.cc include/CommandFailedException.h include/LibraryException.h - unittest/test_C_API.cpp - unittest/catch_main.cpp - unittest/test2.cc - unittest/test3.cc include/LongOperationInProgressException.h include/stick10_commands_0.8.h ) -add_executable(libnitrokey ${SOURCE_FILES})
\ No newline at end of file +#add_library(libnitrokey STATIC ${SOURCE_FILES}) +add_library(nitrokey SHARED ${SOURCE_FILES}) +add_library(catch STATIC unittest/catch_main.cpp ) + +add_executable (test_C_API unittest/test_C_API.cpp) +target_link_libraries (test_C_API PUBLIC nitrokey catch) + +add_executable (test2 unittest/test2.cc) +target_link_libraries (test2 PUBLIC nitrokey catch) + +add_executable (test3 unittest/test3.cc) +target_link_libraries (test3 PUBLIC nitrokey catch) + +add_executable (test_HOTP unittest/test_HOTP.cc) +target_link_libraries (test_HOTP PUBLIC nitrokey catch) + +add_executable (test1 unittest/test.cc) +target_link_libraries (test1 PUBLIC nitrokey catch) diff --git a/unittest/test.cc b/unittest/test.cc index 99f96ac..15235bd 100644 --- a/unittest/test.cc +++ b/unittest/test.cc @@ -1,4 +1,3 @@ -#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() #include "catch.hpp" #include <iostream> diff --git a/unittest/test2.cc b/unittest/test2.cc index 4b61a3c..31dbce8 100644 --- a/unittest/test2.cc +++ b/unittest/test2.cc @@ -1,4 +1,3 @@ -#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() static const char *const default_admin_pin = "12345678"; static const char *const default_user_pin = "123456"; diff --git a/unittest/test3.cc b/unittest/test3.cc index 215df78..5302044 100644 --- a/unittest/test3.cc +++ b/unittest/test3.cc @@ -1,8 +1,3 @@ -// -// Created by sz on 08.11.16. -// - -#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() static const char *const default_admin_pin = "12345678"; static const char *const default_user_pin = "123456"; diff --git a/unittest/test_HOTP.cc b/unittest/test_HOTP.cc index c6b62a3..e6f7d7c 100644 --- a/unittest/test_HOTP.cc +++ b/unittest/test_HOTP.cc @@ -1,4 +1,3 @@ -#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() #include "catch.hpp" #include <iostream> #include "device_proto.h" @@ -14,7 +13,7 @@ using namespace nitrokey::log; using namespace nitrokey::misc; void hexStringToByte(uint8_t data[], const char* hexString){ - assert(strlen(hexString)%2==0); + REQUIRE(strlen(hexString)%2==0); char buf[2]; for(int i=0; i<strlen(hexString); i++){ buf[i%2] = hexString[i]; |