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".
# 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()