diff --git a/CMakeLists.txt b/CMakeLists.txt index ccedec774..492169801 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1862,7 +1862,14 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) # Add warning flags # For "-Wall" see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html set(cxx_warning_flags -Wall -Wextra) - add_compile_options("$<$,CXX>:${cxx_warning_flags}>") + if(NOT (CMAKE_VERSION VERSION_LESS "3.3")) + add_compile_options("$<$:${cxx_warning_flags}>") + else() + add_compile_options("$<$,CXX>:${cxx_warning_flags}>") + endif() + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0") + add_compile_options(-Wno-missing-field-initializers) + endif() if(CMAKE_CROSSCOMPILING) add_compile_options(-Wno-psabi) endif()