Skip to content

Add pkgconfig file for fmt-c library - #4887

Merged
vitaut merged 1 commit into
fmtlib:mainfrom
Ferdi265:feature/fmt-c-pkgconfig
Aug 23, 2026
Merged

Add pkgconfig file for fmt-c library#4887
vitaut merged 1 commit into
fmtlib:mainfrom
Ferdi265:feature/fmt-c-pkgconfig

Conversation

@Ferdi265

@Ferdi265 Ferdi265 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

This PR adds a pkgconfig file for the fmt-c library, allowing the C API to be found and linked via pkgconfig. The CMake package already exports fmt::fmt-c, so that doesn't need changes.

The only thing I was unsure of was if fmt-c.pc should explicitly link -lfmt as well, or if the implicit transitive linkage is enough. For now I have added it, since the fmt::fmt-c CMake target explicitly lists fmt::fmt as a linked library as well, but it can be removed if not needed.

Also, currently the fmt::fmt-c target is part of the fmt_core CMake package component, so I added the fmt_c.pc file to fmt_core as well. Maybe that could be changed to a fmt_c or fmt_c_api component.

@Ferdi265
Ferdi265 requested a review from vitaut as a code owner August 16, 2026 13:49
@Ferdi265
Ferdi265 force-pushed the feature/fmt-c-pkgconfig branch 3 times, most recently from e3cf7ba to fdb68fb Compare August 19, 2026 14:27

@vitaut vitaut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

fmt is an implementation dependency of fmt-c, so I think this should use Requires.private: fmt = @FMT_VERSION@ rather than putting -lfmt in Libs.

@Ferdi265

Copy link
Copy Markdown
Contributor Author

Thanks for the PR.

fmt is an implementation dependency of fmt-c, so I think this should use Requires.private: fmt = @FMT_VERSION@ rather than putting -lfmt in Libs.

I didn't know about Requires.private. Will use that instead, thanks!

@Ferdi265
Ferdi265 force-pushed the feature/fmt-c-pkgconfig branch from fdb68fb to d24f86e Compare August 20, 2026 22:58
@Ferdi265

Copy link
Copy Markdown
Contributor Author

Added Requires.private instead of directly linking -lfmt.

@Ferdi265
Ferdi265 requested a review from vitaut August 20, 2026 23:02
Comment thread CMakeLists.txt Outdated
@Ferdi265
Ferdi265 force-pushed the feature/fmt-c-pkgconfig branch from d24f86e to 1d21d9f Compare August 22, 2026 19:12
@vitaut
vitaut merged commit 488c3b9 into fmtlib:main Aug 23, 2026
46 checks passed
@vitaut

vitaut commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Merged, thanks

@Ferdi265
Ferdi265 deleted the feature/fmt-c-pkgconfig branch August 23, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants