From 78d8e5c3d5108e570bd904242a74548572fc91bc Mon Sep 17 00:00:00 2001 From: Jaap Keuter Date: Thu, 12 Dec 2019 21:28:03 +0100 Subject: [PATCH] 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". --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() -- 2.39.5