Upstream-Status: Backport
Signed-off-by: Ross Burton <ross.burton@intel.com>

From 2abec1cb3c17fa5ec8d945d79acd74a39c38293a Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Wed, 12 Dec 2012 12:57:18 +0000
Subject: cmake: respect existing CMAKE_C_FLAGS

When cross-compiling it's not unusual to need specific arguments passed to gcc
such as --sysroot.  Ensure that these are passed on from the toolchain file by
appending to CMAKE_C_FLAGS instead of overwriting it.

Signed-off-by: Ross Burton <ross.burton@intel.com>

Index: waffle-1.2.2/CMakeLists.txt
===================================================================
--- waffle-1.2.2.orig/CMakeLists.txt	2012-11-28 00:43:40.000000000 +0000
+++ waffle-1.2.2/CMakeLists.txt	2013-02-13 11:34:02.476188233 +0000
@@ -212,7 +212,7 @@
 # ------------------------------------------------------------------------------
 
 # FIXME: Only enable c99 if compiler supports it.
-set(CMAKE_C_FLAGS "--std=c99 -Wall -Werror=implicit-function-declaration")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99 -Wall -Werror=implicit-function-declaration")
 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
     # On MacOS, the SSE2 headers trigger this error.
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=missing-prototypes")
