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".
This commit is contained in:
Jaap Keuter
2019-12-12 21:28:03 +01:00
parent 6c55f65d07
commit 78d8e5c3d5

View File

@@ -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()