···1cmake_minimum_required(VERSION 3.16)
23-if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
4- message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the SDL source code and run \"cmake -S ${CMAKE_SOURCE_DIR} -B .\" from there")
5-endif()
6-7# See docs/release_checklist.md
8project(SDL3 LANGUAGES C VERSION "3.1.5")
9···456sdl_include_directories(
457 PRIVATE
458 "${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/build_config"
459- "${SDL3_BINARY_DIR}/include"
460 "${SDL3_SOURCE_DIR}/include"
461)
462# Note: The clang toolset for Visual Studio does not support the '-idirafter' option.
···3050# config variables may contain generator expression, so we need to generate SDL_build_config.h in 2 steps:
3051# 1. replace all `#cmakedefine`'s and `@abc@`
3052configure_file("${SDL3_SOURCE_DIR}/include/build_config/SDL_build_config.h.cmake"
3053- "${SDL3_BINARY_DIR}/SDL_build_config.h.intermediate")
3054# 2. generate SDL_build_config.h in an build_type-dependent folder (which should be first in the include search path)
3055file(GENERATE
3056 OUTPUT "${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/build_config/SDL_build_config.h"
3057- INPUT "${SDL3_BINARY_DIR}/SDL_build_config.h.intermediate"
3058)
30593060file(GLOB SDL3_INCLUDE_FILES "${SDL3_SOURCE_DIR}/include/SDL3/*.h")
···3078 set(SDL_REVISION "SDL3-${SDL_REVISION_CENTER}")
3079endif()
30803081-execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${SDL3_BINARY_DIR}/include/SDL3")
3082-configure_file(include/build_config/SDL_revision.h.cmake include/SDL3/SDL_revision.h @ONLY)
3083-list(APPEND SDL3_INCLUDE_FILES "${SDL3_BINARY_DIR}/include/SDL3/SDL_revision.h")
30843085if(SDL_FRAMEWORK)
3086 # With Apple frameworks, headers in the PUBLIC_HEADER property also need to be added as sources
···3277set_property(TARGET SDL3_Headers PROPERTY EXPORT_NAME "Headers")
3278target_include_directories(SDL3_Headers
3279 INTERFACE
3280- "$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
3281 "$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
3282)
3283if(SDL_FRAMEWORK)
···1cmake_minimum_required(VERSION 3.16)
200003# See docs/release_checklist.md
4project(SDL3 LANGUAGES C VERSION "3.1.5")
5···452sdl_include_directories(
453 PRIVATE
454 "${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/build_config"
455+ "${SDL3_BINARY_DIR}/include-revision"
456 "${SDL3_SOURCE_DIR}/include"
457)
458# Note: The clang toolset for Visual Studio does not support the '-idirafter' option.
···3046# config variables may contain generator expression, so we need to generate SDL_build_config.h in 2 steps:
3047# 1. replace all `#cmakedefine`'s and `@abc@`
3048configure_file("${SDL3_SOURCE_DIR}/include/build_config/SDL_build_config.h.cmake"
3049+ "${SDL3_BINARY_DIR}/CMakeFiles/SDL_build_config.h.intermediate")
3050# 2. generate SDL_build_config.h in an build_type-dependent folder (which should be first in the include search path)
3051file(GENERATE
3052 OUTPUT "${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/build_config/SDL_build_config.h"
3053+ INPUT "${SDL3_BINARY_DIR}/CMakeFiles/SDL_build_config.h.intermediate"
3054)
30553056file(GLOB SDL3_INCLUDE_FILES "${SDL3_SOURCE_DIR}/include/SDL3/*.h")
···3074 set(SDL_REVISION "SDL3-${SDL_REVISION_CENTER}")
3075endif()
30763077+execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${SDL3_BINARY_DIR}/include-revision/SDL3")
3078+configure_file(include/build_config/SDL_revision.h.cmake include-revision/SDL3/SDL_revision.h @ONLY)
3079+list(APPEND SDL3_INCLUDE_FILES "${SDL3_BINARY_DIR}/include-revision/SDL3/SDL_revision.h")
30803081if(SDL_FRAMEWORK)
3082 # With Apple frameworks, headers in the PUBLIC_HEADER property also need to be added as sources
···3273set_property(TARGET SDL3_Headers PROPERTY EXPORT_NAME "Headers")
3274target_include_directories(SDL3_Headers
3275 INTERFACE
3276+ "$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include-revision>"
3277 "$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
3278)
3279if(SDL_FRAMEWORK)