add compiler flags depending on compiler and version

This commit is contained in:
josch
2014-12-28 09:42:10 +01:00
parent 0bd253bf28
commit 8c5bb77601

View File

@@ -6,7 +6,14 @@ project(mediafire-tools)
# to feed iwyu during tests # to feed iwyu during tests
set(CMAKE_EXPORT_COMPILE_COMMANDS 1) set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Werror -fms-extensions") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Werror")
if (("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR (("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.0)))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fms-extensions")
endif()
# the following is until we learn how to reorder the gcc arguments to correctly link on Ubuntu # the following is until we learn how to reorder the gcc arguments to correctly link on Ubuntu
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-as-needed") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-as-needed")