From 70a3104c4977fc4ea55efb12d4c565b2581edd5c Mon Sep 17 00:00:00 2001 From: Guillaume Racicot Date: Sat, 9 Nov 2019 12:19:49 -0500 Subject: [PATCH] Set C standard at 99 for all example targets Closes #1593. --- examples/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 93b30ed2..7203a925 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -23,6 +23,18 @@ elseif (APPLE) MACOSX_PACKAGE_LOCATION "Resources") endif() +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() + set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h" "${GLFW_SOURCE_DIR}/deps/glad_gl.c") set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"