mirror of
https://github.com/raysan5/raylib.git
synced 2026-08-26 00:51:36 +00:00
[cmake] Fix standalone configuration of examples project (#6079)
Configuring examples/ as a standalone project (cd examples && cmake .) failed with 'Unknown CMake command add_if_flag_compiles' and a missing cmake_minimum_required() error on CMake 4.x. - Add cmake_minimum_required(VERSION 3.22), matching the root project - Include raylib's AddIfFlagCompiles helper via ../cmake - Default PLATFORM to Desktop when not inherited from the raylib build
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
# Setup the project and settings
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(examples)
|
||||
|
||||
# Include raylib's cmake helper functions, so the examples can also be
|
||||
# configured standalone (`cd examples && cmake .`) and not only as part
|
||||
# of the raylib project.
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake")
|
||||
include(AddIfFlagCompiles)
|
||||
|
||||
# Default to the Desktop platform when configured standalone.
|
||||
if (NOT DEFINED PLATFORM)
|
||||
set(PLATFORM "Desktop" CACHE STRING "Platform to build examples for")
|
||||
endif ()
|
||||
|
||||
# Directories that contain examples
|
||||
set(example_dirs
|
||||
audio
|
||||
|
||||
Reference in New Issue
Block a user