Set C standard at 99 for all test targets

Related to #1593.
This commit is contained in:
Guillaume Racicot 2019-11-03 21:12:01 -05:00 committed by Camilla Löwy
parent 8e288dc94c
commit bc5523e994

View File

@ -20,6 +20,18 @@ set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
"${GLFW_SOURCE_DIR}/deps/tinycthread.c") "${GLFW_SOURCE_DIR}/deps/tinycthread.c")
if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR
${CMAKE_VERSION} VERSION_GREATER "3.1.0")
set(CMAKE_C_STANDARD 99)
else()
# Remove this fallback when removing support for CMake version less than 3.1
add_compile_options(
"$<$<C_COMPILER_ID:AppleClang>:-std=c99>"
"$<$<C_COMPILER_ID:Clang>:-std=c99>"
"$<$<C_COMPILER_ID:GNU>:-std=c99>")
endif()
add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL}) add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL})
add_executable(events events.c ${GETOPT} ${GLAD_GL}) add_executable(events events.c ${GETOPT} ${GLAD_GL})
add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL}) add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL})