Add compiler errors/warnings flags

This commit is contained in:
Amine B. Hassouna
2019-02-05 22:56:21 +01:00
parent 1694d30768
commit fc22beed41
2 changed files with 10 additions and 1 deletions

View File

@@ -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 $<$<C_COMPILER_ID:MSVC>:/W4 /WX>)
target_compile_options(${PROJECT_NAME} PRIVATE $<$<NOT:$<C_COMPILER_ID:MSVC>>:-Wall -Wextra -pedantic -Werror>)
# Add SDL2 library
find_package(SDL2 REQUIRED)
target_link_libraries(${PROJECT_NAME} SDL2::Main)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Amine Ben Hassouna <amine.benhassouna@gmail.com>
* Copyright (c) 2018, 2019 Amine Ben Hassouna <amine.benhassouna@gmail.com>
* 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)
{