sdl_link_dependency() and pkg-config

Hi all!

I’m writing a new SDL3 backend, and I’ve trouble understanding how the dependencies should be declared in the CMakeLists.txt file. All my dependencies ship pkg-config files, but I’m unable to have them fully working. What I do:

sdl_link_dependency(egc LIBS embedded-game-controller)

This works, but only adds -lembedded-game-controller to the link options, whereas I would also like it to:

  1. Add the -I flag with the include path;
  2. Add -lbt-embedded, since it’s a dependency (Requires:) declared in embedded-game-controller.pc

Both of these points are easy to address manually (the first one with sdl_include_directories(), the second with an additional call to sdl_link_dependency()), but it seems wrong, since it defeats the point of using pkg-config. Am I using this function in the wrong way?

I’m way out of my depth here.
I think you need to add something to tell cmake about your pc file and where to find it.

There’s just a much smaller sub-section of users here that also know cmake, that also know pkg-config.

Thanks @Sward , I did actually find the function definition and looked at the comments, but all my attempts to use it failed: no errors, but the function did not actually bring in the pkg-config dependencies.