summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAlex Richardson <arichardson.kde@gmail.com>2022-03-19 14:58:59 +0000
committerRalf Habacker <ralf.habacker@freenet.de>2022-03-29 12:21:46 +0000
commitd35554c111787064aa773495f4b14107b742e340 (patch)
treeefd405ca044d1996109a4da30cdb1e4b6d9620df /CMakeLists.txt
parent0a22950288488226c3f322151962be55aed06508 (diff)
downloaddbus-d35554c111787064aa773495f4b14107b742e340.tar.gz
cmake: Only add warning flags if the compiler supports them
I am compiling for FreeBSD where the compiler is Clang and doesn't accept all the GCC warning flags. This breaks the -Werror build: ``` error: unknown warning option '-Wduplicated-branches' [-Werror,-Wunknown-warning-option] error: unknown warning option '-Wduplicated-cond' [-Werror,-Wunknown-warning-option] error: unknown warning option '-Wjump-misses-init' [-Werror,-Wunknown-warning-option] error: unknown warning option '-Wlogical-op'; did you mean '-Wlong-long'? [-Werror,-Wunknown-warning-option] error: unknown warning option '-Wrestrict' [-Werror,-Wunknown-warning-option] error: unknown warning option '-Wunused-but-set-variable'; did you mean '-Wunused-const-variable'? [-Werror,-Wunknown-warning-option] ``` With this change we use check_{c,cxx}_compiler_flag to check if the flag is supported before adding it. In the future this will allow adding clang-specific warning flags to the list of warnings as well since they will be ignored for GCC.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt1
1 files changed, 1 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc4926e3..890618dc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -356,6 +356,7 @@ generate_compiler_warning_flags(
${WARNINGS_ERRORS}
)
generate_compiler_warning_flags(
+ CXX
RESULTVAR
WARNINGS_CXXFLAGS
WARNINGS