2017-07-23 02:45:36 +03:00
|
|
|
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.")
|
|
|
|
|
2017-11-27 03:24:08 +03:00
|
|
|
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()
|
2018-01-18 15:22:41 +03:00
|
|
|
include(CheckCCompilerFlag)
|
2018-01-26 00:34:29 +03:00
|
|
|
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()
|
|
|
|
|
2017-11-27 03:24:08 +03:00
|
|
|
|
2017-07-23 02:45:36 +03:00
|
|
|
add_subdirectory(src release)
|
|
|
|
|
|
|
|
if (${BUILD_EXAMPLES})
|
|
|
|
add_subdirectory(examples)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (${BUILD_GAMES})
|
|
|
|
add_subdirectory(games)
|
|
|
|
endif()
|
|
|
|
|