Skip to content

Cannot link to static fluidsynth libraries from CMake #1648

@madebr

Description

@madebr

FluidSynth version

2.4.8

Describe the bug

The msys2 mingw package only support linking to a shared fluidsynth when using FluidSynth::libfluidsynth.

See mingw-w64-x86_64-fluidsynth: tar archive

FluidSynth-targets.cmake only defines a SHARED IMPORTED target. I can't see a STATIC IMPORTED target.

Expected behavior

I can link to a static fluidsynth library, using find_package(FluidSynth REQUIRED CONFIG).

Steps to reproduce

  1. Install msys2 / mingw64
  2. Open mingw bash
  3. Install mingw-w64-x86_64-fluidsynth (+ gcc + cmake)
  4. Create a CMake script that uses FluidSynth, configure and build it
    cmake_minimum_required(VERSION 3.20)
    project(use_fluidsynth)
    find_package(FluidSynth REQUIRED CONFIG)
    
    # FluidSynth::libfluidsynth is always SHARED
    add_executable(test test.c)
    target_link_libraries(test PRIVATE FluidSynth::libfluidsynth)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions