Skip to content

cmake: keep internal link deps out of the public pkg-config Libs - #173

Merged
georgmartius merged 1 commit into
masterfrom
fix/pkgconfig-private-libs
Aug 5, 2026
Merged

cmake: keep internal link deps out of the public pkg-config Libs#173
georgmartius merged 1 commit into
masterfrom
fix/pkgconfig-private-libs

Conversation

@georgmartius

Copy link
Copy Markdown
Owner

The generated vidstab.pc listed -lm and the OpenMP flags in Libs:, so every consumer of the library inherited them. None of them appear in the installed headers, so for a shared build they belong in Libs.private.

When BUILD_SHARED_LIBS is off they stay in Libs, since a static libvidstab cannot resolve them on its own and consumers may call plain pkg-config --libs.

Verified across gcc/clang × shared/static — the ffmpeg configure check (compile + -Wl,--as-needed link against the pkg-config flags) passes in all four:

build Libs Libs.private
gcc, shared -L${libdir} -lvidstab -lm -fopenmp
gcc, static -L${libdir} -lvidstab -lm -fopenmp -lm -fopenmp
clang, shared -L${libdir} -lvidstab -lm
clang, static -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

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
georgmartius force-pushed the fix/pkgconfig-private-libs branch from 57a7c34 to 26f8fa7 Compare August 5, 2026 22:18
@georgmartius
georgmartius merged commit ccf85e3 into master Aug 5, 2026
4 checks passed
@georgmartius
georgmartius deleted the fix/pkgconfig-private-libs branch August 7, 2026 05:50
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.

openmp related linking issue with ffmpeg

1 participant