How to create pkgconfig file

I’m experiencing same issue. The generator expressions of all those linked libraries and conditions make it impossible to do that from reading some target property.

I think this is the way to go in CMake’s case but seems to be stalled at the time of writing: https://gitlab.kitware.com/cmake/cmake/-/issues/22621

Otherwise, I’ll probably have to collect these private libraries into a list variable over the configuration phase. Yes, quite annoying approach and feels like moving few steps back with all these imported and interface targets, but is probably the least error prone.

I’ve also tried parsing the CMakeFiles/<target_name>.dir/link.txt file but it would be a bit difficult to get all libraries based on the various linkers and combinations correctly manually.

1 Like