Improve compilation options

This commit is contained in:
Carles Fernandez 2019-02-24 20:22:15 +01:00
parent ccf575de86
commit d2a3de3c58
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
1 changed files with 8 additions and 1 deletions

View File

@ -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("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${cxx_warning_flags}>")
if(NOT (CMAKE_VERSION VERSION_LESS "3.3"))
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${cxx_warning_flags}>")
else()
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,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()