summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2017-09-21 23:39:32 +0200
committerAndrej Rode <mail@andrejro.de>2017-09-21 23:39:32 +0200
commitd7e875ae67c99eaa26ccb92f8c3a802690694356 (patch)
tree783b8fc6e429b8faf293191845ec1a132402644c
parent535e0082964206fe76d24a4ea13eb3f61f0ce0a9 (diff)
cmake: fix build issue with introduction with -std=c99 define
-rw-r--r--CMakeLists.txt10
1 files changed, 3 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b351f5e37c..a08ecf750d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,19 +71,15 @@ ELSE()
ENDIF()
IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
- SET(CMAKE_C_STANDARD 99)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
- SET(CMAKE_C_STANDARD 99)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
- SET(CMAKE_C_STANDARD 11)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
ELSE()
message(warning "C standard could not be set because compiler is not GNU, Clang or MSVC.")
ENDIF()
-# if cmake version is < 3.1, explicitly set C standard to use.
-IF(${CMAKE_VERSION} VERSION_LESS "3.1")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c${CMAKE_C_STANDARD}")
-ENDIF()
# Set cmake policies.
# This will suppress developer warnings during the cmake process that can occur