From 8c46a3e9f91de1ae6a60b31c0961b9109f3f6c5f Mon Sep 17 00:00:00 2001 From: Guillaume Racicot Date: Sun, 3 Nov 2019 21:12:01 -0500 Subject: [PATCH] Set C standard at 99 for all test targets Related to #1593. (cherry picked from commit bc5523e994ff79304b2a690b354b7531dbbe1246) --- tests/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fcc99243..4f49c770 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -20,6 +20,18 @@ set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" "${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( + "$<$:-std=c99>" + "$<$:-std=c99>" + "$<$:-std=c99>") + +endif() + add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL}) add_executable(events events.c ${GETOPT} ${GLAD_GL}) add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL})