From d2a3de3c5871c727a72bfaeff094ff8205eddad8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 24 Feb 2019 20:22:15 +0100 Subject: [PATCH] Improve compilation options --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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()