[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:
parent
9bde204f1d
commit
2c0021ad89
1 changed files with 12 additions and 0 deletions
|
|
@ -1,6 +1,18 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
|
cmake_minimum_required(VERSION 3.22)
|
||||||
project(examples)
|
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
|
# Directories that contain examples
|
||||||
set(example_dirs
|
set(example_dirs
|
||||||
audio
|
audio
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue