From 7ae96c710b579f8beb58d713e0e93192755bd37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 31 Jan 2017 17:37:27 +0100 Subject: [PATCH] Returned basic warnings to CMake generated builds --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e2b23c3..f4ca23c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -238,6 +238,17 @@ include_directories(${HEADER_DIR}) add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${HEADERS}) add_executable(Benchmark ${BENCH_SOURCES} ${HEADERS}) +# Add desired warnings +if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" ) + target_compile_options( SelfTest PRIVATE -Wall -Wextra ) + target_compile_options( Benchmark PRIVATE -Wall -Wextra ) +endif() +if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) + target_compile_options( SelfTest PRIVATE /W4 ) + target_compile_options( Benchmark PRIVATE /W4 ) +endif() + + # configure unit tests via CTest enable_testing() add_test(NAME RunTests COMMAND SelfTest)