#6157·raylib

[build] SDL backend: using vendored SDL causes error in raylib's InstallConfigurations.cmake logic

Author: SaturnWorksCreated Sep 16, 2026Updated Sep 17, 2026

Whenever I try to use the raylib SDL backend with a vendored SDL subproject unpatched, I get an error like this:

CMake Error in thirdparty/raylib/src/CMakeLists.txt:
  install(EXPORT "raylib-targets" ...) includes target "raylib" which
  requires target "SDL3-shared" that is not in any export set.

This is the CMakeLists.txt that I use:

cmake
project(raysdl)
cmake_minimum_required(VERSION 3.16)

if (APPLE)
    enable_language(OBJC)
endif()

add_executable(${PROJECT_NAME})

add_subdirectory(src)
add_subdirectory(thirdparty) # adds SDL and raylib subdirectories

target_link_libraries(${PROJECT_NAME} SDL3::SDL3)
target_link_libraries(${PROJECT_NAME} raylib)

if (APPLE)
    target_link_libraries(${PROJECT_NAME} "-framework IOKit")
    target_link_libraries(${PROJECT_NAME} "-framework Cocoa")
    target_link_libraries(${PROJECT_NAME} "-framework QuartzCore")
    target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
endif()

The quick and dirty solution was patching InstallConfigurations.cmake by wrapping it with an if(PROJECT_IS_TOP_LEVEL) condition. After that, it works fine. Perhaps that fix could be integrated?