SDL/cmake/SDL3Config.cmake.in

88 lines
2.5 KiB
CMake

# SDL cmake project-config input for CMakeLists.txt script
include(FeatureSummary)
set_package_properties(SDL3 PROPERTIES
URL "https://www.libsdl.org/"
DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware"
)
@PACKAGE_INIT@
set(SDL3_FOUND TRUE)
set(_sdl3_framework @SDL_FRAMEWORK@)
# Find SDL3::Headers
if(NOT TARGET SDL3::Headers)
include("${CMAKE_CURRENT_LIST_DIR}/SDL3headersTargets.cmake")
# Manually add `-F <parent folder of SDL3.framework>` to make sure `#include "SDL3/..."` works.
if(_sdl3_framework)
set_property(TARGET SDL3::Headers APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "SHELL:-F \"@PACKAGE_CMAKE_INSTALL_PREFIX@\"")
endif()
endif()
set(SDL3_Headers_FOUND TRUE)
# Find SDL3::SDL3
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake")
set(SDL3_SDL3_FOUND TRUE)
endif()
# Find SDL3::SDL3-static
if(_sdl3_framework)
find_package(SDL3-static CONFIG)
if(SDL3-static_FOUND)
set(SDL3_SDL3-static_FOUND TRUE)
endif()
else()
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake")
if(ANDROID OR HAIKU)
enable_language(CXX)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake")
set(SDL3_SDL3-static_FOUND TRUE)
endif()
endif()
# Find SDL3::SDL3_test
if(_sdl3_framework)
find_package(SDL3_test CONFIG)
if(SDL3_test_FOUND)
enable_language(OBJC)
set(SDL3_SDL3_test_FOUND TRUE)
endif()
else()
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake")
set(SDL3_SDL3_test_FOUND TRUE)
endif()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/sdlfind.cmake")
set(SDL_ALSA @SDL_ALSA@)
set(SDL_ALSA_SHARED @SDL_ALSA_SHARED@)
if(SDL_ALSA AND NOT SDL_ALSA_SHARED AND TARGET SDL3::SDL3-static)
sdlFindALSA()
endif()
unset(SDL_ALSA)
unset(SDL_ALSA_SHARED)
check_required_components(SDL3)
# Create SDL3::SDL3 alias for static-only builds
if(TARGET SDL3::SDL3-static AND NOT TARGET SDL3::SDL3)
if(CMAKE_VERSION VERSION_LESS "3.18")
# FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global.
add_library(SDL3::SDL3 INTERFACE IMPORTED)
set_target_properties(SDL3::SDL3 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL3::SDL3-static")
else()
add_library(SDL3::SDL3 ALIAS SDL3::SDL3-static)
endif()
endif()
set(SDL3_LIBRARIES SDL3::SDL3)
set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static)
set(SDL3_STATIC_PRIVATE_LIBS)
set(SDL3TEST_LIBRARY SDL3::SDL3_test)