From 55af5c07a45a0b51c2f7bbe487862f8781ab9c56 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 31 Mar 2017 13:40:51 +0200 Subject: Show warnings during the compilation and treat warnings as error Signed-off-by: Szczepan Zalega --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 09cb023..a1f582a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,14 @@ set(CMAKE_CXX_STANDARD 14) OPTION(LIBNITROKEY_STATIC "Build libnitrokey statically" TRUE) +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() + OPTION(COMPILE_TESTS "Compile tests" FALSE) IF (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo) @@ -122,6 +130,8 @@ IF (COMPILE_TESTS) ENDIF() + + #SET(CPACK_GENERATOR # "DEB;RPM") # build a CPack driven installer package -- cgit v1.2.1