commit 25d8df0: [Minor] do not pass invalid C warnings to C++ flags

Christian Göttsche cgzones at googlemail.com
Fri Jan 17 16:07:12 UTC 2020


Author: Christian Göttsche
Date: 2020-01-16 15:09:46 +0100
URL: https://github.com/rspamd/rspamd/commit/25d8df0b735c6b966b05cc3ce4a8f69cf20b199f (refs/pull/3220/head)

[Minor] do not pass invalid C warnings to C++ flags
cc1plus: warning: command line option ‘-Wno-pointer-sign’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++

---
 cmake/CompilerWarnings.cmake | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake
index b9bb7ffde..4dd011d98 100644
--- a/cmake/CompilerWarnings.cmake
+++ b/cmake/CompilerWarnings.cmake
@@ -35,10 +35,12 @@ IF(SUPPORT_WUNUSED_VAR)
     ADD_COMPILE_OPTIONS("-Wunused-variable")
 ENDIF(SUPPORT_WUNUSED_VAR)
 IF(SUPPORT_WPOINTER_SIGN)
-    ADD_COMPILE_OPTIONS("-Wno-pointer-sign")
+    # only valid for C
+    ADD_COMPILE_OPTIONS($<$<COMPILE_LANGUAGE:C>:-Wno-pointer-sign>)
 ENDIF(SUPPORT_WPOINTER_SIGN)
 IF(SUPPORT_WSTRICT_PROTOTYPES)
-    ADD_COMPILE_OPTIONS("-Wstrict-prototypes")
+    # only valid for C
+    ADD_COMPILE_OPTIONS($<$<COMPILE_LANGUAGE:C>:-Wstrict-prototypes>)
 ENDIF(SUPPORT_WSTRICT_PROTOTYPES)
 IF(SUPPORT_WSTRICT_ALIASING)
     ADD_COMPILE_OPTIONS("-Wno-strict-aliasing")


More information about the Commits mailing list