Add error flags (no changes yet)
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 6 Aug 2017 07:59:55 +0000 (17:59 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 6 Aug 2017 07:59:55 +0000 (17:59 +1000)
CMakeLists.txt

index 397737a..bbad9b9 100644 (file)
@@ -63,15 +63,49 @@ endif ()
 #-----------------------------------------------------------------------
 
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
-macro(addflags args)
+macro(addflags_c args)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${args}")
+endmacro()
+macro(addflags_cxx args)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${args}")
 endmacro()
+macro(addflags args)
+    addflags_c("${args}")
+    addflags_cxx("${args}")
+endmacro()
 addflags("-fno-strict-aliasing")
 if (NOT WIN32)
     addflags("-fvisibility=hidden")
 endif ()
 
+if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+    addflags("-Werror")
+    addflags("-pedantic-errors")
+endif ()
+
+addflags("-Wall")
+addflags("-Wextra")
+addflags("-pedantic")
+
+addflags("-Wno-extra")
+addflags("-Wno-switch")
+addflags("-Wno-pedantic")
+addflags("-Wno-parentheses")
+addflags("-Wno-write-strings")
+addflags("-Wno-unused-function")
+addflags("-Wno-unused-variable")
+addflags("-Wno-unused-parameter")
+addflags("-Wno-deprecated-declarations")
+addflags("-Wno-unused-but-set-variable")
+addflags("-Wno-missing-field-initializers")
+
+addflags_c("-Wno-int-conversion")
+addflags_c("-Wno-pointer-to-int-cast")
+addflags_c("-Wno-incompatible-pointer-types")
+
+addflags_cxx("-Wno-reorder")
+addflags_cxx("-Wno-delete-non-virtual-dtor")
+
 set(CMAKE_POSITION_INDEPENDENT_CODE 1)
 set(GTK_TARGET 2 CACHE STRING "GTK target")
 add_definitions(-DGTK_TARGET=${GTK_TARGET})