Skip to content

Commit

Permalink
Fix some warnings and wrong console output on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
crudelios committed Jul 25, 2023
1 parent ba98878 commit 9f23a82
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if (CMAKE_COMPILER_IS_GNUCC)
endif()

if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0)
set(CMAKE_C_FLAGS "-Walloc-zero -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wformat=2 -Wformat-signedness -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-prototypes -Wshadow -Wundef -Wunused-macros -Wwrite-strings ${CMAKE_C_FLAGS}")
set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Walloc-zero -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wformat=2 -Wformat-signedness -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-prototypes -Wshadow -Wundef -Wunused-macros -Wwrite-strings")
endif()
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND "${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND NOT ${TARGET_PLATFORM} STREQUAL "android")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
Expand Down Expand Up @@ -797,8 +797,13 @@ endif()

if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
string(REGEX REPLACE "/W3" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8 /wd4100 /wd4244 /wd4131")
string(REGEX REPLACE "/W3" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set_source_files_properties(${EXPAT_FILES} PROPERTIES COMPILE_FLAGS "/W3")
set_source_files_properties(${PNG_FILES} PROPERTIES COMPILE_FLAGS "/W3")
set_source_files_properties(${ZLIB_FILES} PROPERTIES COMPILE_FLAGS "/W3")
set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "/W4")
set_source_files_properties(${PROJECT_SOURCE_DIR}/res/augustus.rc PROPERTIES COMPILE_FLAGS "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8 /wd4100 /wd4244")
endif()

# Show debug info on crash on 32 bit builds compiled with MinGW
Expand Down
2 changes: 1 addition & 1 deletion src/platform/augustus.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static void write_log(void *userdata, int category, SDL_LogPriority priority, co
#if defined(_MSC_VER) && !defined(NDEBUG)
OutputDebugStringA(log_text);
#else
write_to_output(stdout, message);
write_to_output(stdout, log_text);
#endif
}

Expand Down

0 comments on commit 9f23a82

Please sign in to comment.