cmake: capitalize SDL3::Headers target
parent
d45f0a0566
commit
23c2c15a70
|
@ -3096,24 +3096,24 @@ if(SDL_FRAMEWORK)
|
||||||
list(APPEND SOURCE_FILES ${SDL_FRAMEWORK_RESOURCES})
|
list(APPEND SOURCE_FILES ${SDL_FRAMEWORK_RESOURCES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(SDL3_headers INTERFACE)
|
add_library(SDL3_Headers INTERFACE)
|
||||||
add_library(SDL3::headers ALIAS SDL3_headers)
|
add_library(SDL3::Headers ALIAS SDL3_Headers)
|
||||||
set_target_properties(SDL3_headers PROPERTIES
|
set_target_properties(SDL3_Headers PROPERTIES
|
||||||
EXPORT_NAME "headers"
|
EXPORT_NAME "Headers"
|
||||||
)
|
)
|
||||||
target_include_directories(SDL3_headers
|
target_include_directories(SDL3_Headers
|
||||||
INTERFACE
|
INTERFACE
|
||||||
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
|
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
|
||||||
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
|
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
|
||||||
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include/SDL3>"
|
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include/SDL3>"
|
||||||
)
|
)
|
||||||
if(SDL_FRAMEWORK)
|
if(SDL_FRAMEWORK)
|
||||||
target_include_directories(SDL3_headers
|
target_include_directories(SDL3_Headers
|
||||||
INTERFACE
|
INTERFACE
|
||||||
"$<INSTALL_INTERFACE:SDL3.framework/Headers>"
|
"$<INSTALL_INTERFACE:SDL3.framework/Headers>"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
target_include_directories(SDL3_headers
|
target_include_directories(SDL3_Headers
|
||||||
INTERFACE
|
INTERFACE
|
||||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL3>"
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL3>"
|
||||||
|
@ -3186,7 +3186,7 @@ if(SDL_SHARED)
|
||||||
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
|
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
|
||||||
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/src>"
|
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/src>"
|
||||||
)
|
)
|
||||||
target_link_libraries(SDL3 PUBLIC $<TARGET_NAME:SDL3::headers>)
|
target_link_libraries(SDL3 PUBLIC $<TARGET_NAME:SDL3::Headers>)
|
||||||
# This picks up all the compiler options and such we've accumulated up to here.
|
# This picks up all the compiler options and such we've accumulated up to here.
|
||||||
target_link_libraries(SDL3 PRIVATE $<BUILD_INTERFACE:sdl-build-options>)
|
target_link_libraries(SDL3 PRIVATE $<BUILD_INTERFACE:sdl-build-options>)
|
||||||
target_link_libraries(SDL3 PRIVATE $<BUILD_INTERFACE:sdl-shared-build-options>)
|
target_link_libraries(SDL3 PRIVATE $<BUILD_INTERFACE:sdl-shared-build-options>)
|
||||||
|
@ -3230,7 +3230,7 @@ if(SDL_STATIC)
|
||||||
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
|
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
|
||||||
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/src>"
|
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/src>"
|
||||||
)
|
)
|
||||||
target_link_libraries(SDL3-static PUBLIC $<TARGET_NAME:SDL3::headers>)
|
target_link_libraries(SDL3-static PUBLIC $<TARGET_NAME:SDL3::Headers>)
|
||||||
# This picks up all the compiler options and such we've accumulated up to here.
|
# This picks up all the compiler options and such we've accumulated up to here.
|
||||||
target_link_libraries(SDL3-static PRIVATE $<BUILD_INTERFACE:sdl-build-options>)
|
target_link_libraries(SDL3-static PRIVATE $<BUILD_INTERFACE:sdl-build-options>)
|
||||||
target_link_libraries(SDL3-static PRIVATE $<BUILD_INTERFACE:sdl-global-options>)
|
target_link_libraries(SDL3-static PRIVATE $<BUILD_INTERFACE:sdl-global-options>)
|
||||||
|
@ -3273,7 +3273,7 @@ if(SDL_TEST)
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
|
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
|
||||||
)
|
)
|
||||||
target_link_libraries(SDL3_test PUBLIC $<TARGET_NAME:SDL3::headers>)
|
target_link_libraries(SDL3_test PUBLIC $<TARGET_NAME:SDL3::Headers>)
|
||||||
target_link_libraries(SDL3_test PRIVATE ${EXTRA_TEST_LIBS})
|
target_link_libraries(SDL3_test PRIVATE ${EXTRA_TEST_LIBS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -3314,7 +3314,7 @@ if(NOT SDL_DISABLE_INSTALL)
|
||||||
|
|
||||||
##### Installation targets #####
|
##### Installation targets #####
|
||||||
|
|
||||||
install(TARGETS SDL3_headers EXPORT SDL3headersTargets)
|
install(TARGETS SDL3_Headers EXPORT SDL3headersTargets)
|
||||||
|
|
||||||
if(SDL_SHARED)
|
if(SDL_SHARED)
|
||||||
install(TARGETS SDL3 EXPORT SDL3Targets
|
install(TARGETS SDL3 EXPORT SDL3Targets
|
||||||
|
|
|
@ -50,14 +50,14 @@ set(SDL3TEST_LIBRARY SDL3::SDL3_test)
|
||||||
# All targets are created, even when some might not be requested though COMPONENTS.
|
# All targets are created, even when some might not be requested though COMPONENTS.
|
||||||
# This is done for compatibility with CMake generated SDL3-target.cmake files.
|
# This is done for compatibility with CMake generated SDL3-target.cmake files.
|
||||||
|
|
||||||
if(NOT TARGET SDL3::headers)
|
if(NOT TARGET SDL3::Headers)
|
||||||
add_library(SDL3::headers INTERFACE IMPORTED)
|
add_library(SDL3::Headers INTERFACE IMPORTED)
|
||||||
set_target_properties(SDL3::SDL3
|
set_target_properties(SDL3::SDL3
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_include_dirs}"
|
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_include_dirs}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
set(SDL3_headers_FOUND TRUE)
|
set(SDL3_Headers_FOUND TRUE)
|
||||||
unset(_sdl3_include_dirs)
|
unset(_sdl3_include_dirs)
|
||||||
|
|
||||||
set(_sdl3_library "${SDL3_LIBDIR}/SDL3.lib")
|
set(_sdl3_library "${SDL3_LIBDIR}/SDL3.lib")
|
||||||
|
@ -67,7 +67,7 @@ if(EXISTS "${_sdl3_library}" AND EXISTS "${_sdl3_dll_library}")
|
||||||
add_library(SDL3::SDL3 SHARED IMPORTED)
|
add_library(SDL3::SDL3 SHARED IMPORTED)
|
||||||
set_target_properties(SDL3::SDL3
|
set_target_properties(SDL3::SDL3
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
INTERFACE_LINK_LIBRARIES "SDL3::headers"
|
INTERFACE_LINK_LIBRARIES "SDL3::Headers"
|
||||||
IMPORTED_IMPLIB "${_sdl3_library}"
|
IMPORTED_IMPLIB "${_sdl3_library}"
|
||||||
IMPORTED_LOCATION "${_sdl3_dll_library}"
|
IMPORTED_LOCATION "${_sdl3_dll_library}"
|
||||||
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
|
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
|
||||||
|
@ -87,7 +87,7 @@ if(EXISTS "${_sdl3test_library}")
|
||||||
add_library(SDL3::SDL3_test STATIC IMPORTED)
|
add_library(SDL3::SDL3_test STATIC IMPORTED)
|
||||||
set_target_properties(SDL3::SDL3_test
|
set_target_properties(SDL3::SDL3_test
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
INTERFACE_LINK_LIBRARIES "SDL3::headers"
|
INTERFACE_LINK_LIBRARIES "SDL3::Headers"
|
||||||
IMPORTED_LOCATION "${_sdl3test_library}"
|
IMPORTED_LOCATION "${_sdl3test_library}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -44,15 +44,15 @@ set(SDL3_LIBRARIES "SDL3::SDL3")
|
||||||
# All targets are created, even when some might not be requested though COMPONENTS.
|
# All targets are created, even when some might not be requested though COMPONENTS.
|
||||||
# This is done for compatibility with CMake generated SDL3-target.cmake files.
|
# This is done for compatibility with CMake generated SDL3-target.cmake files.
|
||||||
|
|
||||||
if(NOT TARGET SDL3::headers)
|
if(NOT TARGET SDL3::Headers)
|
||||||
add_library(SDL3::headers INTERFACE IMPORTED)
|
add_library(SDL3::Headers INTERFACE IMPORTED)
|
||||||
set_target_properties(SDL3::headers
|
set_target_properties(SDL3::Headers
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${_sdl3_framework_parent_path}\""
|
INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${_sdl3_framework_parent_path}\""
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_include_dirs}"
|
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_include_dirs}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
set(SDL3_headers_FOUND TRUE)
|
set(SDL3_Headers_FOUND TRUE)
|
||||||
unset(_sdl3_include_dirs)
|
unset(_sdl3_include_dirs)
|
||||||
|
|
||||||
if(NOT TARGET SDL3::SDL3)
|
if(NOT TARGET SDL3::SDL3)
|
||||||
|
@ -60,7 +60,7 @@ if(NOT TARGET SDL3::SDL3)
|
||||||
set_target_properties(SDL3::SDL3
|
set_target_properties(SDL3::SDL3
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
FRAMEWORK "TRUE"
|
FRAMEWORK "TRUE"
|
||||||
INTERFACE_LINK_LIBRARIES "SDL3::headers"
|
INTERFACE_LINK_LIBRARIES "SDL3::Headers"
|
||||||
IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3"
|
IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3"
|
||||||
IMPORTED_SONAME "${_sdl3_framework_path}/SDL3"
|
IMPORTED_SONAME "${_sdl3_framework_path}/SDL3"
|
||||||
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
|
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
|
||||||
|
|
|
@ -11,15 +11,15 @@ set_package_properties(SDL3 PROPERTIES
|
||||||
set(SDL3_FOUND TRUE)
|
set(SDL3_FOUND TRUE)
|
||||||
set(_sdl3_framework @SDL_FRAMEWORK@)
|
set(_sdl3_framework @SDL_FRAMEWORK@)
|
||||||
|
|
||||||
# Find SDL3::headers
|
# Find SDL3::Headers
|
||||||
if(NOT TARGET SDL3::headers)
|
if(NOT TARGET SDL3::Headers)
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL3headersTargets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/SDL3headersTargets.cmake")
|
||||||
# Manually add `-F <parent folder of SDL3.framework>` to make sure `#include "SDL3/..."` works.
|
# Manually add `-F <parent folder of SDL3.framework>` to make sure `#include "SDL3/..."` works.
|
||||||
if(_sdl3_framework)
|
if(_sdl3_framework)
|
||||||
set_property(TARGET SDL3::headers APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "SHELL:-F \"@PACKAGE_CMAKE_INSTALL_PREFIX@\"")
|
set_property(TARGET SDL3::Headers APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "SHELL:-F \"@PACKAGE_CMAKE_INSTALL_PREFIX@\"")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
set(SDL3_headers_FOUND TRUE)
|
set(SDL3_Headers_FOUND TRUE)
|
||||||
|
|
||||||
# Find SDL3::SDL3
|
# Find SDL3::SDL3
|
||||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake")
|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake")
|
||||||
|
|
|
@ -27,9 +27,9 @@ add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library")
|
||||||
option(TEST_STATIC "Test linking to static SDL3 library" ON)
|
option(TEST_STATIC "Test linking to static SDL3 library" ON)
|
||||||
add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library")
|
add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library")
|
||||||
|
|
||||||
find_package(SDL3 REQUIRED CONFIG COMPONENTS headers)
|
find_package(SDL3 REQUIRED CONFIG COMPONENTS Headers)
|
||||||
add_library(headers_test OBJECT inc_sdl_slash.c inc_sdl_noslash.c)
|
add_library(headers_test OBJECT inc_sdl_slash.c inc_sdl_noslash.c)
|
||||||
target_link_libraries(headers_test PRIVATE SDL3::headers)
|
target_link_libraries(headers_test PRIVATE SDL3::Headers)
|
||||||
|
|
||||||
if(TEST_SHARED)
|
if(TEST_SHARED)
|
||||||
find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
|
find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
|
||||||
|
|
Loading…
Reference in New Issue