From fc22beed4127a958e4e03d9a350dad9b5b7ec03b Mon Sep 17 00:00:00 2001 From: "Amine B. Hassouna" Date: Tue, 5 Feb 2019 22:56:21 +0100 Subject: [PATCH] Add compiler errors/warnings flags --- CMakeLists.txt | 5 +++++ src/main.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf15d10..c270441 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,11 @@ add_executable(${PROJECT_NAME} ${SOURCES}) # Add all headers files under the include directory target_include_directories(${PROJECT_NAME} PRIVATE include) +# Add compiler errors/warnings flags +target_compile_options(${PROJECT_NAME} PRIVATE $<$:/W4 /WX>) +target_compile_options(${PROJECT_NAME} PRIVATE $<$>:-Wall -Wextra -pedantic -Werror>) + + # Add SDL2 library find_package(SDL2 REQUIRED) target_link_libraries(${PROJECT_NAME} SDL2::Main) diff --git a/src/main.c b/src/main.c index 3d51411..9b76e15 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Amine Ben Hassouna + * Copyright (c) 2018, 2019 Amine Ben Hassouna * All rights reserved. * * Permission is hereby granted, free of charge, to any @@ -43,6 +43,10 @@ int main(int argc, char* argv[]) { + // Unused argc, argv + (void) argc; + (void) argv; + // Initialize SDL if(SDL_Init(SDL_INIT_VIDEO) < 0) {