File tree 3 files changed +22
-4
lines changed
3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,10 @@ if(NOT TARGET uninstall)
59
59
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake)
60
60
endif ()
61
61
62
- if (${BUILD_EXAMPLES} )
62
+ if (NOT ${BUILD_EXAMPLE} STREQUAL "" )
63
+ MESSAGE (STATUS "Building example '${BUILD_EXAMPLE} '" )
64
+ add_subdirectory (examples)
65
+ elseif (${BUILD_EXAMPLES} )
63
66
MESSAGE (STATUS "Building examples is enabled" )
64
67
add_subdirectory (examples)
65
68
endif ()
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific
8
8
9
9
# Configuration options
10
10
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
11
+ option(BUILD_EXAMPLE "Build a specific example by filename." "")
11
12
option(CUSTOMIZE_BUILD "Show options for customizing your Raylib library build." OFF)
12
13
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
13
14
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
Original file line number Diff line number Diff line change @@ -48,10 +48,24 @@ endif ()
48
48
# into a CMake variable
49
49
set (example_sources)
50
50
set (example_resources)
51
+ set (example_found FALSE )
51
52
foreach (example_dir ${example_dirs} )
52
- # Get the .c files
53
- file (GLOB sources ${example_dir} /*.c)
54
- list (APPEND example_sources ${sources} )
53
+ if (BUILD_EXAMPLE)
54
+ if (NOT example_found)
55
+ file (GLOB sources ${example_dir} /${BUILD_EXAMPLE} .c)
56
+ if (EXISTS ${sources} )
57
+ list (APPEND example_sources ${sources} )
58
+ set (example_found TRUE )
59
+ message ("Raylib example '${BUILD_EXAMPLE} .c' found in ${example_dir} !" )
60
+ else ()
61
+ message ("Raylib example '${BUILD_EXAMPLE} .c' not found in ${example_dir} ..." )
62
+ endif ()
63
+ endif ()
64
+ else ()
65
+ # Get the .c files
66
+ file (GLOB sources ${example_dir} /*.c)
67
+ list (APPEND example_sources ${sources} )
68
+ endif ()
55
69
56
70
# Any any resources
57
71
file (GLOB resources ${example_dir} /resources/*)
You can’t perform that action at this time.
0 commit comments