Exception being newer cmake versions that will decay to gnu99 in
certain situations. This decay currently hides a warning in minigzip,
but using C99 with C_STANDARD_REQUIRED on could potentially introduce
unknown problems on other platforms, so for now we will allow this decay.
include(CheckCSourceRuns)
include(FeatureSummary)
+# Enable C99
+if (CMAKE_VERSION VERSION_LESS "3.1")
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ set (CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
+ endif ()
+else ()
+ set (CMAKE_C_STANDARD 99)
+endif ()
+
# make sure we use an appropriate BUILD_TYPE by default, "Release" to be exact
# this should select the maximum generic optimisation on the current platform (i.e. -O3 for gcc/clang)
if(NOT CMAKE_BUILD_TYPE)
if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then
echo ... using gcc >> configure.log
CC="$cc"
+ CFLAGS="${CFLAGS} -std=c99"
# Re-check arch if gcc is a cross-compiler
GCC_ARCH=`$CC -dumpmachine | sed 's/-.*//g'`
case $GCC_ARCH in