From 72f1ffca315378465b2aa83dd399f8a4f026c59c Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Thu, 12 Apr 2018 15:37:05 +0200 Subject: [PATCH] cmake: force c99 to be set in the compiler Signed-off-by: Brendan Le Foll Signed-off-by: malikabhi05 --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa75a8b..e98534b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,14 @@ project (mraa C CXX) FIND_PACKAGE (Threads REQUIRED) +if (CMAKE_VERSION VERSION_LESS "3.1") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}") + endif () +else () + set (CMAKE_C_STANDARD 99) +endif () + ############################################################################### # Detect supported warning flags # Modified from work By Dan Liew (fpbench - MIT)