Skip to content

Commit

Permalink
Link FLAC libraries for dynamic linking too
Browse files Browse the repository at this point in the history
  • Loading branch information
alef committed Sep 24, 2023
1 parent f4f2381 commit 33b9dac
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions CMakeModules/Find/FindSDL2_mixer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,30 @@ set(SDL2MIXER_FOUND ${SDL2_MIXER_FOUND})

mark_as_advanced(SDL2_MIXER_LIBRARY SDL2_MIXER_INCLUDE_DIR)

if(NOT DYNAMIC_LINKING AND PKGCONFIG_FOUND)
if(NOT DYNAMIC_LINKING)
if (NOT TARGET SDL2_mixer::SDL2_mixer-static)
add_library(SDL2_mixer::SDL2_mixer-static STATIC IMPORTED)
set_property(TARGET SDL2_mixer::SDL2_mixer-static
PROPERTY IMPORTED_LOCATION ${SDL2_MIXER_LIBRARY}
)
endif()
message(STATUS "Searching for SDL_mixer deps libraries --")
pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac)
target_link_libraries(SDL2_mixer::SDL2_mixer-static INTERFACE
PkgConfig::FLAC
)
elseif(NOT TARGET SDL2_mixer::SDL2_mixer)
add_library(SDL2_mixer::SDL2_mixer STATIC IMPORTED)
set_property(TARGET SDL2_mixer::SDL2_mixer
PROPERTY IMPORTED_LOCATION ${SDL2_MIXER_LIBRARY}
)
endif()

endif()
if(PKG_CONFIG_FOUND)
message(STATUS "Searching for SDL_mixer deps libraries --")
pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac)
if(TARGET SDL2_mixer::SDL2_mixer-static)
target_link_libraries(SDL2_mixer::SDL2_mixer-static INTERFACE
PkgConfig::FLAC
)
elseif(TARGET SDL2_mixer::SDL2_mixer)
target_link_libraries(SDL2_mixer::SDL2_mixer INTERFACE
PkgConfig::FLAC
)
endif()
endif()

0 comments on commit 33b9dac

Please sign in to comment.