From eb216a952407cae6cb8c456e1178721d4e6b36da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 26 Nov 2019 08:32:57 +0100 Subject: [PATCH] cmake: use extra compiler warnings only on gcc6+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc version 4.8.4 (Ubuntu 14.04) and -Wextra produces following: json_script.c:124:3: error: missing initializer for field 'name' of 'struct blobmsg_policy' [-Werror=missing-field-initializers] Reported-by: Jonas Gorski Signed-off-by: Petr Štetiar --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b80d551..da7d03c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,12 @@ INCLUDE(CheckLibraryExists) INCLUDE(CheckFunctionExists) PROJECT(ubox C) -ADD_DEFINITIONS(-Os -Wextra -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -Wno-unused-parameter) + +ADD_DEFINITIONS(-Wall -Werror) +IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6) + ADD_DEFINITIONS(-Wextra) +ENDIF() +ADD_DEFINITIONS(-Os -std=gnu99 -g3 -Wmissing-declarations -Wno-unused-parameter) OPTION(BUILD_LUA "build Lua plugin" ON) OPTION(BUILD_EXAMPLES "build examples" ON)