Skip to content

Commit f6db8ff

Browse files
TheMarexPatrick Niklaus
authored andcommitted
Disabel missing initialization warning on GCC 4.9
1 parent 26e5c4e commit f6db8ff

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM
259259

260260
# Since gcc 4.9 the LTO format is non-standart ('slim'), so we need to use the build-in tools
261261
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND
262-
NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0" AND NOT MINGW)
262+
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0 AND NOT MINGW)
263263
find_program(GCC_AR gcc-ar)
264264
find_program(GCC_RANLIB gcc-ranlib)
265265
if ("${GCC_AR}" STREQUAL "GCC_AR-NOTFOUND" OR "${GCC_RANLIB}" STREQUAL "GCC_RANLIB-NOTFOUND")
@@ -288,7 +288,7 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM
288288
endif()
289289
endif()
290290

291-
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0")
291+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0)
292292
message(STATUS "Disabling LTO on GCC < 4.9.0 since it is broken, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57038")
293293
set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}")
294294
set(ENABLE_LTO Off)
@@ -330,6 +330,13 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
330330
endif()
331331
# using GCC
332332
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OSRM_WARNING_FLAGS} -Werror=strict-overflow=1 -Wno-error=maybe-uninitialized -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${COLOR_FLAG} -fPIC -ftemplate-depth=1024")
333+
334+
# Disable missing field initializer since this has a lot of false positives with incomplete curly-braces
335+
# initialization support on 4.9
336+
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9)
337+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=missing-field-initializers")
338+
endif()
339+
333340
if(WIN32) # using mingw
334341
add_dependency_defines(-DWIN32)
335342
set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)

0 commit comments

Comments
 (0)