]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
Don't enable -Werror for release builds
authorMatthew Barr <matthew.barr@intel.com>
Tue, 1 Mar 2016 00:04:09 +0000 (11:04 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Tue, 1 Mar 2016 00:42:49 +0000 (11:42 +1100)
Using -Werror is a very good thing during development, but it has the
potential to break the user's build, for example, if they are using a slightly
different compiler combination to one that has been tested previously.

CMakeLists.txt

index 77af34a5692018b2ce3bee56117b0b877962195f..49c9a4add880d289d1553192ca549ef7f482d4d2 100644 (file)
@@ -171,8 +171,14 @@ else()
     endif()
 
     # set compiler flags - more are tested and added later
-    set(EXTRA_C_FLAGS "-std=c99 -Wall -Wextra -Wshadow -Wcast-qual -Werror")
-    set(EXTRA_CXX_FLAGS "-std=c++11 -Wall -Wextra -Werror -Wno-shadow -Wswitch -Wreturn-type -Wcast-qual -Wno-deprecated -Wnon-virtual-dtor")
+    set(EXTRA_C_FLAGS "-std=c99 -Wall -Wextra -Wshadow -Wcast-qual")
+    set(EXTRA_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wno-shadow -Wswitch -Wreturn-type -Wcast-qual -Wno-deprecated -Wnon-virtual-dtor")
+    if (NOT RELEASE_BUILD)
+        # -Werror is most useful during development, don't potentially break
+        # release builds
+        set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror")
+        set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Werror")
+    endif()
 
     if (NOT CMAKE_C_FLAGS MATCHES .*march.*)
         message(STATUS "Building for current host CPU")