2017-07-23 02:45:36 +03:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
2021-01-14 01:10:02 +03:00
|
|
|
project(raylib)
|
|
|
|
|
|
|
|
# Directory for easier includes
|
2021-01-26 16:34:27 +03:00
|
|
|
# Anywhere you see include(...) you can check <root>/cmake for that file
|
2018-05-20 21:08:43 +03:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
2017-07-23 02:45:36 +03:00
|
|
|
|
2021-01-26 16:34:27 +03:00
|
|
|
# RAYLIB_IS_MAIN determines whether the project is being used from root
|
|
|
|
# or if it is added as a dependency (through add_subdirectory for example).
|
2020-12-14 21:24:20 +03:00
|
|
|
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
set(RAYLIB_IS_MAIN TRUE)
|
|
|
|
else()
|
|
|
|
set(RAYLIB_IS_MAIN FALSE)
|
|
|
|
endif()
|
|
|
|
|
2021-01-14 01:10:02 +03:00
|
|
|
# Sets compiler flags and language standard
|
|
|
|
include(CompilerFlags)
|
2018-02-24 17:26:13 +03:00
|
|
|
|
2021-01-14 01:10:02 +03:00
|
|
|
# Registers build options that are exposed to cmake
|
|
|
|
include(CMakeOptions.txt)
|
2017-11-27 03:24:08 +03:00
|
|
|
|
2021-01-26 16:34:27 +03:00
|
|
|
# Enforces a few environment and compiler configurations
|
2021-01-14 01:10:02 +03:00
|
|
|
include(BuildOptions)
|
2018-03-14 17:23:14 +03:00
|
|
|
|
2021-01-14 01:10:02 +03:00
|
|
|
# Main sources directory (the second parameter sets the output directory name to raylib)
|
|
|
|
add_subdirectory(src raylib)
|
2017-07-23 02:45:36 +03:00
|
|
|
|
|
|
|
if (${BUILD_EXAMPLES})
|
2020-12-14 21:24:20 +03:00
|
|
|
MESSAGE(STATUS "Building examples is enabled")
|
2017-07-23 02:45:36 +03:00
|
|
|
add_subdirectory(examples)
|
|
|
|
endif()
|
|
|
|
|
2018-07-03 21:34:31 +03:00
|
|
|
enable_testing()
|