CMake: Enable warnings

Not every exercise has the same levels,
but they now have at least some warnings.
Simon Bruder 2023-05-20 12:10:36 +02:00
parent bd651ee6db
commit ec7fe4ea6d
1 changed files with 5 additions and 0 deletions

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)