summaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAhmad Fatoum <[email protected]>2017-11-27 01:24:08 +0100
committerAhmad Fatoum <[email protected]>2017-11-27 02:10:56 +0100
commitca921e5a53fdd3412f5f81e3a739f54d68cb63a7 (patch)
treedc9299aa50dd53bdd13e4b5491c8a0e18a11afe2 /CMakeLists.txt
parent7099e4ea4d663ae409ea55496951b64ed61989fc (diff)
downloadraylib-ca921e5a53fdd3412f5f81e3a739f54d68cb63a7.tar.gz
raylib-ca921e5a53fdd3412f5f81e3a739f54d68cb63a7.zip
CMake: Explicitly ask for C99 support
Otherwise using a compiler that defaults to -std=c89 or -std=gnu89 will fail. Example: http://www.cpantesters.org/cpan/report/abb85066-d283-11e7-9926-b2f4efb9c382 Apparently, -m32 Travis CI build was broken: -m32 was overridden by -std=gnu99. This fixes that.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0dfa0857..057481bd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,14 @@ cmake_minimum_required(VERSION 3.0)
set(BUILD_EXAMPLES ON CACHE BOOL "Build the examples.")
set(BUILD_GAMES ON CACHE BOOL "Build the example games.")
+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()
+
add_subdirectory(src release)
if (${BUILD_EXAMPLES})