From ec7fe4ea6d4dfbfaf18044e920b33c59ab6c2f22 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 20 May 2023 12:10:36 +0200 Subject: [PATCH] CMake: Enable warnings Not every exercise has the same levels, but they now have at least some warnings. --- u01/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/u01/CMakeLists.txt b/u01/CMakeLists.txt index ce35d11..95192e0 100644 --- a/u01/CMakeLists.txt +++ b/u01/CMakeLists.txt @@ -7,6 +7,11 @@ set(CMAKE_CXX_STANDARD 17) # On GNU this has the effect of passing -std=c++11 instead of -std=gnu++11 set(CMAKE_CXX_EXTENSIONS no) +# Enable all compiler warnings (and make them errors) on GNU/Clang platforms +if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang)$") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") +endif() + add_library(tree node.cpp) add_executable(main main.cpp) target_link_libraries(main tree)