Merge pull request #4915 from rael346/cmake-replace-custom-variable

cmake: replace custom variable with built-in one
This commit is contained in:
Ray 2025-04-28 23:11:56 +02:00 committed by GitHub
commit d1a3f93077
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 2 additions and 11 deletions

View file

@ -23,14 +23,6 @@ cmake_policy(SET CMP0063 NEW)
# Anywhere you see include(...) you can check <root>/cmake for that file # Anywhere you see include(...) you can check <root>/cmake for that file
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# RAYLIB_IS_MAIN determines whether the project is being used from root
# or if it is added as a dependency (through add_subdirectory for example).
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(RAYLIB_IS_MAIN TRUE)
else()
set(RAYLIB_IS_MAIN FALSE)
endif()
# Sets compiler flags and language standard # Sets compiler flags and language standard
include(CompilerFlags) include(CompilerFlags)

View file

@ -11,7 +11,7 @@ enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL" "Platform to bui
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific OpenGL Version?") enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific OpenGL Version?")
# Configuration options # Configuration options
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN}) option(BUILD_EXAMPLES "Build the examples." ${PROJECT_IS_TOP_LEVEL})
option(CUSTOMIZE_BUILD "Show options for customizing your Raylib library build." OFF) option(CUSTOMIZE_BUILD "Show options for customizing your Raylib library build." OFF)
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF) option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF) option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)

View file

@ -18,7 +18,6 @@ if (NOT raylib_FOUND) # If there's none, fetch and build raylib
if (NOT raylib_POPULATED) # Have we downloaded raylib yet? if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
set(FETCHCONTENT_QUIET NO) set(FETCHCONTENT_QUIET NO)
FetchContent_MakeAvailable(raylib) FetchContent_MakeAvailable(raylib)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
endif() endif()
endif() endif()

View file

@ -8,7 +8,7 @@ include(JoinPaths)
# Sets build type if not set by now # Sets build type if not set by now
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if(RAYLIB_IS_MAIN) if(PROJECT_IS_TOP_LEVEL)
set(default_build_type Debug) set(default_build_type Debug)
else() else()
message(WARNING "Default build type is not set (CMAKE_BUILD_TYPE)") message(WARNING "Default build type is not set (CMAKE_BUILD_TYPE)")