CMake: use "Requires:" for .pc generation (fixes static linking)#691
CMake: use "Requires:" for .pc generation (fixes static linking)#691JohannesKauffmann wants to merge 1 commit intoLibVNC:masterfrom
Conversation
One (rather, my) use case for this is the VNC client plugin in VLC Media Player, which on Windows/Apple (generally non-Unix) is statically linked to: See also: |
9bb2b9a to
55d9ff6
Compare
|
(now fixed my committer identity, sorry for the noise) |
CMakeLists.txt
Outdated
| option(WITH_LIBVNCSERVER "Build libvncserver" ON) | ||
| option(WITH_LIBVNCCLIENT "Build libvncclient" ON) | ||
| option(BUILD_SHARED_LIBS "Build shared libraries" ${UNIX}) | ||
| option(WITH_TESTS "Build tests" ON) |
There was a problem hiding this comment.
please don't re-order the options, it's not pertainining to the proposed change
There was a problem hiding this comment.
okay, dropped for now.
| Version: @LibVNCServer_VERSION@ | ||
| Requires: | ||
| Requires.private: | ||
| Requires: @LIBVNC_REQUIRES@ |
There was a problem hiding this comment.
ack these, but you should differentiate between libvncclient and -server here :-)
There was a problem hiding this comment.
Hi, thanks for the review. Indeed I did assume that the dependencies were common between server and client. Now it's split; as far as I could tell:
- sasl is client-only
- libsystemd and libpng are server-only
- the rest is common
Instead of trying to translate/parse the INTERFACE link flags from CMake to the .pc file, make use of the more native-to-pkg-config "Requires" and "Requires.private", so that we can refer to the whole dependent .pc pacakge name. This fixes static linking when the dependencies of static libraries are also static, and allows for using pkg-config all the way down. When sasl and zlib are found, Rfb public headers also include headers from these libraries so they are the only ones listed in "Requires". The others can be in "Requires.private". libsystemd and libpng are exclusively libvncserver dependencies, while sasl is exclusively a libvncclient dependency. The rest of the libraries are common dependencies to both. Signed-off-by: Johannes Kauffmann <johanneskauffmann@hotmail.com>
55d9ff6 to
8b89f5e
Compare
Instead of trying to translate/parse the INTERFACE link flags from CMake
to the .pc file, make use of the more native-to-pkg-config "Requires"
and "Requires.private", so that we can refer to the whole dependent .pc
pacakge name.
This fixes static linking when the dependencies of static libraries are
also static, and allows for using pkg-config all the way down.
When sasl and zlib are found, Rfb public headers also include headers
from these libraries so they are the only ones listed in "Requires".
The others can be in "Requires.private".
Additionally, re-order the CMake option()'s such that all the different types are grouped by type (general, dependencies, examples) and rewrite WITH_XCB description to clarify that this concerns an example.
Signed-off-by: Johannes Kauffmann johanneskauffmann@hotmail.com