Link against FluidSynth's imported target and find its dependencies

* Link against FluidSynth at all (not sure how the Windows build has with
  FluidSynth enabled has ever been working without actually linking to the
  FluidSynth's library)
* The imported target of FluidSynth does not automatically make the targets
  it depends on available. So we need to find the according packages
  manually.
This commit is contained in:
Martchus 2023-01-22 20:04:46 +01:00
parent fab9af593e
commit 39882a6db6
1 changed files with 11 additions and 0 deletions

View File

@ -121,7 +121,18 @@ if(WITH_INTERNAL_FLUIDSYNTH)
INCLUDE_DIRECTORIES(${FLUIDSYNTH_INCLUDE_DIRS})
SET(FLUIDSYNTH_LIBRARY ${FLUIDSYNTH_LIBRARIES})
else()
# find FluidSynth and link against its imported target
FIND_PACKAGE(FluidSynth REQUIRED)
SET(FLUIDSYNTH_LIBRARY FluidSynth::libfluidsynth)
# find additional dependencies that are pulled in by the imported target but not automatically made available
FIND_PACKAGE(OpenMP REQUIRED)
if (COMMAND pkg_check_modules)
pkg_check_modules(GLIB IMPORTED_TARGET glib-2.0 gthread-2.0)
pkg_check_modules(LIBSNDFILE IMPORTED_TARGET sndfile)
pkg_check_modules(PORTAUDIO IMPORTED_TARGET portaudio-2.0)
pkg_check_modules(READLINE IMPORTED_TARGET readline)
endif ()
endif()
ADD_DEFINITIONS(-DWITH_INTERNAL_FLUIDSYNTH)
MESSAGE("Building with internal fluidsynth")