aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-11-09 11:36:02 -0800
committerChris Robinson <[email protected]>2015-11-09 11:36:02 -0800
commitde53ff4aff2e3c19dfb29baa6d3e3c053aedbfbb (patch)
tree9bb20cb202042968971295e6eba06cbc70625aaf /CMakeLists.txt
parentceee5c8ffb8dc9852ed393eb8a5b7594c33fef47 (diff)
Build with -std=c11 if possible
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt11
1 files changed, 8 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ff904bac..b7bbe691 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -101,9 +101,14 @@ CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
-CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99)
-IF(HAVE_STD_C99)
- SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
+CHECK_C_COMPILER_FLAG(-std=c11 HAVE_STD_C11)
+IF(HAVE_STD_C11)
+ SET(CMAKE_C_FLAGS "-std=c11 ${CMAKE_C_FLAGS}")
+ELSE()
+ CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99)
+ IF(HAVE_STD_C99)
+ SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
+ ENDIF()
ENDIF()
# MSVC may need workarounds for C99 restrict and inline