Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export dynamic and static library names in sdl2_image-config cmake input file #390

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions sdl2_image-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ set_package_properties(SDL2_image PROPERTIES

set(SDL2_image_FOUND TRUE)

set(SDL2_IMAGE_LIBRARIES SDL2_image::SDL2_image)
set(SDL2_IMAGE_STATIC_LIBRARIES SDL2_image::SDL2_image-static)

set(SDL2IMAGE_AVIF @LOAD_AVIF@)
set(SDL2IMAGE_BMP @LOAD_BMP@)
set(SDL2IMAGE_GIF @LOAD_GIF@)
Expand Down Expand Up @@ -61,32 +64,32 @@ unset(libdir)

include(CMakeFindDependencyMacro)

if(NOT TARGET SDL2_image::SDL2_image)
add_library(SDL2_image::SDL2_image SHARED IMPORTED)
set_target_properties(SDL2_image::SDL2_image
if(NOT TARGET ${SDL2_IMAGE_LIBRARIES})
add_library(${SDL2_IMAGE_LIBRARIES} SHARED IMPORTED)
set_target_properties(${SDL2_IMAGE_LIBRARIES}
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_sdl2image_incdir}"
COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED"
INTERFACE_SDL2_SHARED "ON"
)
if(WIN32)
set_target_properties(SDL2_image::SDL2_image
set_target_properties(${SDL2_IMAGE_LIBRARIES}
PROPERTIES
IMPORTED_LOCATION "${_sdl2image_bindir}/SDL2_image.dll"
IMPORTED_IMPLIB "${_sdl2image_libdir}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2_image.dll${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
else()
set_target_properties(SDL2_image::SDL2_image
set_target_properties(${SDL2_IMAGE_LIBRARIES}
PROPERTIES
IMPORTED_LOCATION "${_sdl2image_libdir}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2_image${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
endif()
endif()

if(NOT TARGET SDL2_image::SDL2_image-static)
add_library(SDL2_image::SDL2_image-static STATIC IMPORTED)
if(NOT TARGET ${SDL2_IMAGE_STATIC_LIBRARIES})
add_library(${SDL2_IMAGE_STATIC_LIBRARIES} STATIC IMPORTED)

set_target_properties(SDL2_image::SDL2_image-static
set_target_properties(${SDL2_IMAGE_STATIC_LIBRARIES}
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_sdl2image_incdir}"
IMPORTED_LOCATION "${_sdl2image_libdir}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2_image${CMAKE_STATIC_LIBRARY_SUFFIX}"
Expand Down