From: Jaap Keuter Date: Thu, 12 Dec 2019 20:28:03 +0000 (+0100) Subject: Properly append to CMAKE_C_FLAGS string X-Git-Tag: json-c-0.14-20200419~67^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F512%2Fhead;p=thirdparty%2Fjson-c.git Properly append to CMAKE_C_FLAGS string Contrary to other CMAKE variables the CMAKE_C_FLAGS variable is the composed string of flags for the C compiler. It is therefore not a list to append to. Current implementation results in these incorrect CFLAGS, e.g., "-O2 -g -fblahblah;-UNDEBUG". Extending the CFLAGS this way results in the proper CFLAGS, e.g., "-O2 -g -fblahblah -UNDEBUG". --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 72679db5..15e32586 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -54,6 +54,6 @@ endforeach(TESTNAME) # Make sure NDEBUG is always undefined for tests if (UNIX OR MINGW OR CYGWIN) - list(APPEND CMAKE_C_FLAGS -UNDEBUG) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -UNDEBUG") endif()