From 3da0a2bf4fca5a321431d2daa13564e5d985ee97 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Sat, 12 Sep 2015 11:22:13 -0700 Subject: [PATCH] Remove policy that broke posix and fix gcc warning A Clang only flag was set for all builds. Signed-off-by: Mark Charlebois --- CMakeLists.txt | 1 - cmake/common/px4_base.cmake | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 041966b1d0..116897c584 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,7 +142,6 @@ project(px4 CXX C ASM) if (NOT ${CMAKE_VERSION} VERSION_LESS 3.0.0) cmake_policy(SET CMP0045 NEW) # error on non-existent target in get prop cmake_policy(SET CMP0046 NEW) # no non-existent targets as dependencies - cmake_policy(SET CMP0054 NEW) # don't dereference quoted variables endif() set(version_major 1) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 492e02ae4b..73a73d21e8 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -498,7 +498,6 @@ function(px4_add_common_flags) -Werror=reorder -Werror=uninitialized -Werror=init-self - -Wno-unused-const-variable #-Wcast-qual - generates spurious noreturn attribute warnings, # try again later #-Wconversion - would be nice, but too many "risky-but-safe" @@ -507,7 +506,11 @@ function(px4_add_common_flags) # but generates too many false positives ) - if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + list(APPEND warnings + -Wno-unused-const-variable + ) + else(${CMAKE_C_COMPILER_ID} STREQUAL "Clang") list(APPEND warnings -Werror=unused-but-set-variable -Wformat=1