cmake: keep internal link deps out of the public pkg-config Libs - #173
Merged
Conversation
georgmartius
force-pushed
the
fix/pkgconfig-private-libs
branch
from
August 5, 2026 22:12
6f78d13 to
57a7c34
Compare
The generated vidstab.pc listed -lm and the OpenMP flags in Libs:, so every consumer of the library inherited them whether it wanted them or not. None of these appear in the installed headers, so for a shared build they belong in Libs.private, where only static consumers see them. A static libvidstab cannot resolve them on its own, so when BUILD_SHARED_LIBS is off they stay in Libs as before and plain "pkg-config --libs" keeps working. Fixes #34
georgmartius
force-pushed
the
fix/pkgconfig-private-libs
branch
from
August 5, 2026 22:18
57a7c34 to
26f8fa7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The generated
vidstab.pclisted-lmand the OpenMP flags inLibs:, so every consumer of the library inherited them. None of them appear in the installed headers, so for a shared build they belong inLibs.private.When
BUILD_SHARED_LIBSis off they stay inLibs, since a static libvidstab cannot resolve them on its own and consumers may call plainpkg-config --libs.Verified across gcc/clang × shared/static — the ffmpeg configure check (compile +
-Wl,--as-neededlink against the pkg-config flags) passes in all four:-L${libdir} -lvidstab-lm -fopenmp-L${libdir} -lvidstab -lm -fopenmp-lm -fopenmp-L${libdir} -lvidstab-lm-L${libdir} -lvidstab -lm-lm(the clang rows have no OpenMP because libomp is not installed on the test box)
Full unit test suite passes: 36/36.
Fixes #34
🤖 Generated with Claude Code