CMake: Enable warnings

Not every exercise has the same levels,
but they now have at least some warnings.
This commit is contained in:
Simon Bruder 2023-05-20 12:10:36 +02:00
parent 329aa0b455
commit 002ef8d707

View file

@ -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)