aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-03-31 15:48:12 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-31 15:48:12 +0200
commit46e8303872d7bff61b519eee43a9a026529acfac (patch)
tree9f2ce9efba18f63ff5edcea926d2245c0d46a29c
parentdd41e1dfbf05fcc800d4dc9a4d1d3a70925b7607 (diff)
downloadlibnitrokey-46e8303872d7bff61b519eee43a9a026529acfac.tar.gz
libnitrokey-46e8303872d7bff61b519eee43a9a026529acfac.tar.bz2
Do not fail compilation on tests
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--CMakeLists.txt18
1 files changed, 10 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e07a5fd..7c379da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,13 +75,6 @@ ELSEIF(WIN32)
target_link_libraries(hidapi-libusb setupapi)
ENDIF()
-OPTION(ERROR_ON_WARNING "Stop compilation on warning found (not supported for MSVC)" ON)
-if (NOT MSVC)
- add_compile_options(-Wall -Wno-unused-function -Wcast-qual -Woverloaded-virtual)
- if (ERROR_ON_WARNING)
- add_compile_options(-Werror)
- endif()
-endif()
IF (NOT LIBNITROKEY_STATIC)
add_library(nitrokey SHARED ${SOURCE_FILES})
@@ -98,6 +91,15 @@ ENDIF()
target_link_libraries(${LIBNAME} hidapi-libusb)
target_link_libraries(${LIBNAME}-log hidapi-libusb)
+OPTION(ERROR_ON_WARNING "Stop compilation on warning found (not supported for MSVC)" ON)
+if (NOT MSVC)
+ set(COMPILE_FLAGS "-Wall -Wno-unused-function -Wcast-qual -Woverloaded-virtual")
+ if (ERROR_ON_WARNING)
+ set(COMPILE_FLAGS "${COMPILE_FLAGS} -Werror")
+ endif()
+ SET_TARGET_PROPERTIES(${LIBNAME} ${LIBNAME}-log PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS} )
+endif()
+
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_DEFINITIONS "NO_LOG")
@@ -108,7 +110,7 @@ IF (COMPILE_TESTS)
include_directories(unittest/Catch/include)
add_library(catch SHARED unittest/catch_main.cpp )
-
+
add_executable (test_C_API unittest/test_C_API.cpp)
target_link_libraries (test_C_API ${EXTRA_LIBS} ${LIBNAME} catch)