cmake option to download raylib

This commit is contained in:
Luka Jankovic 2025-07-02 17:41:48 +02:00
parent ecc8a1df95
commit d94e24f63a

View file

@ -5,8 +5,28 @@ project(kubo LANGUAGES C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(RAYLIB_VERSION 5.5)
find_package(raylib ${RAYLIB_VERSION} REQUIRED)
option(USE_SYSTEM_RAYLIB "Use system-installed raylib instead of downloading" OFF)
if(USE_SYSTEM_RAYLIB)
set(RAYLIB_VERSION 5.5)
find_package(raylib ${RAYLIB_VERSION} REQUIRED)
else()
include(FetchContent)
set(FETCHCONTENT_QUIET FALSE)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # don't build the supplied example games
set(GLFW_BUILD_WAYLAND "Build the bundled GLFW with Wayland support" ON)
set(GLFW_BUILD_X11 "Build the bundled GLFW with X11 support" ON)
FetchContent_Declare(
raylib
GIT_REPOSITORY "https://github.com/raysan5/raylib.git"
GIT_TAG "master"
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(raylib)
endif()
set(SOURCES
kubo_command.c