aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt13
1 files changed, 12 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3dacb48..43d15df 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,7 +66,9 @@ set(SOURCE_FILES
NitrokeyManager.cc
NK_C_API.h
NK_C_API.cc
- DeviceCommunicationExceptions.cpp)
+ DeviceCommunicationExceptions.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/version.cc
+ )
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build all libraries as shared")
add_library(nitrokey ${SOURCE_FILES})
@@ -115,6 +117,11 @@ IF (LOG_VOLATILE_DATA)
ENDIF()
+# generate version.h
+exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "describe --always" OUTPUT_VARIABLE PROJECT_VERSION_GIT)
+configure_file("version.cc.in" "version.cc" @ONLY)
+
+
file(GLOB LIB_INCLUDES "libnitrokey/*.h" "NK_C_API.h")
install (FILES ${LIB_INCLUDES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
install (TARGETS nitrokey DESTINATION ${CMAKE_INSTALL_LIBDIR})
@@ -171,6 +178,10 @@ IF(COMPILE_OFFLINE_TESTS)
#run with 'make test' or 'ctest'
include (CTest)
add_test (runs test_offline)
+
+ add_executable(test_minimal unittest/test_minimal.c)
+ target_link_libraries(test_minimal ${EXTRA_LIBS} nitrokey)
+ add_test(minimal test_minimal)
ENDIF()
IF (COMPILE_TESTS)