summaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
blob: 11db057ee648ec6b9056edf1e5c973f034f29536 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
cmake_minimum_required(VERSION 3.0)

# Config options
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()
include(CheckCCompilerFlag)
foreach(option -Werror=pointer-arith;-Werror=implicit-function-declaration)
    CHECK_C_COMPILER_FLAG("${option}" COMPILER_HAS_THOSE_TOGGLES)
    set(outcome "Failed")
    if(COMPILER_HAS_THOSE_TOGGLES)
        set(CMAKE_C_FLAGS "${option} ${CMAKE_C_FLAGS}")
        set(outcome "works")
    endif()
    message(STATUS "Testing if ${option} can be used -- ${outcome}")
endforeach()


add_subdirectory(src release)

if (${BUILD_EXAMPLES})
  add_subdirectory(examples)
endif()

if (${BUILD_GAMES})
  add_subdirectory(games)
endif()