summaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorhristo <[email protected]>2020-12-14 20:24:20 +0200
committerGitHub <[email protected]>2020-12-14 19:24:20 +0100
commit3ec8ac52f8760fb5dba2d2bacabf7ca2fe5c55d9 (patch)
treed1befb2b4882655bf52a1ac482fe7e7ce7973050 /CMakeLists.txt
parent6e79476650321cd08c6814a304887d378b54799f (diff)
downloadraylib-3ec8ac52f8760fb5dba2d2bacabf7ca2fe5c55d9.tar.gz
raylib-3ec8ac52f8760fb5dba2d2bacabf7ca2fe5c55d9.zip
Building examples by default only if raylib is standalone. (#1460)
This change only modifies the default value. In cmake you can have raylib as a subdirectory (dependency) and when you have it as dependency you wouldn't probably want to use the example by default. You can still use the option to enable them though.
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-xCMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6b163526..e3fbd117 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,14 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+ set(RAYLIB_IS_MAIN TRUE)
+else()
+ set(RAYLIB_IS_MAIN FALSE)
+endif()
+
# Config options
-option(BUILD_EXAMPLES "Build the examples." ON)
+option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended to run with ASAN)" OFF)
@@ -48,6 +54,7 @@ endif()
add_subdirectory(src)
if (${BUILD_EXAMPLES})
+ MESSAGE(STATUS "Building examples is enabled")
add_subdirectory(examples)
endif()