You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2019/06/19 13:52:10 UTC

[qpid-cpp] 02/10: QPID-7360: Neater way to turn warnings to errors that supports multiple compilers

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-cpp.git

commit c1afea7d6be060bcceaf3644bdeec4842854b68e
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Fri Jun 14 02:00:34 2019 -0400

    QPID-7360: Neater way to turn warnings to errors that supports multiple compilers
---
 CMakeLists.txt     |  1 +
 src/CMakeLists.txt | 10 ++++------
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90f139b..807517e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -148,6 +148,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
   # -Wshadow - warns about boost headers.
   set (WARNING_FLAGS
      "-pedantic -Wall -Wextra -Wno-shadow -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wvolatile-register-var -Winvalid-pch -Wno-system-headers -Woverloaded-virtual -Wno-deprecated-declarations")
+  set (WARNING_ERROR "-Werror")
 
   if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7)
     set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-implicit-fallthrough")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 82141ef..d3aad73 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -151,12 +151,10 @@ if (VALGRIND_FOUND)
   option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
 endif (VALGRIND_FOUND)
 
-if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
-  option(ENABLE_WARNING_ERROR "Consider compiler warnings to be errors" ON)
-  if (ENABLE_WARNING_ERROR)
-    set(WARNING_FLAGS "${WARNING_FLAGS} -Werror")
-  endif (ENABLE_WARNING_ERROR)
-endif (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
+option(ENABLE_WARNING_ERROR "Consider compiler warnings to be errors" ON)
+if (ENABLE_WARNING_ERROR)
+  set (WARNING_FLAGS "${WARNING_ERROR} ${WARNING_FLAGS}")
+endif (ENABLE_WARNING_ERROR)
 
 if (GCC_VERSION AND NOT GCC_VERSION VERSION_LESS 5.1)
   option(ENABLE_GLIBCXX_OLD_ABI "Enable old (pre GCC 5.1) C++ ABI" OFF)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org