[CMake] Finding library dependencies
Hendrik Sattler
post at hendrik-sattler.de
Wed May 23 15:10:37 EDT 2007
Am Mittwoch 23 Mai 2007 20:37 schrieb Pau Garcia i Quiles:
> Quoting Hendrik Sattler <post at hendrik-sattler.de>:
> > Am Mittwoch 23 Mai 2007 16:28 schrieb Pau Garcia i Quiles:
> >> I am writing a FindQwt5.cmake script. As Qwt 5.x can be dynamically
> >> linked against Qt3 or Qt4, on Unix I use 'ldd' to find out (on most
> >> cases) what version of Qt is Qwt linked to.
> >>
> >> Is there anything like 'ldd' in Windows which is installed by default
> >> on the system? I mean, Dependency Walker ships with Visual Studio but
> >> it is not installed by default and what about Borland users? Is there
> >> anything like that?
> >
> > If Qwt does not provide proper stuff for this, it will always be messy.
> > Maybe you should suggest to Qwt upstream to use pkg-config?
>
> I am not a pkg-config expert but I cannot see how it would help here.
>
> The problem with Qwt (and a lot of other open source projects) is it
> does not provide an installer or a "make install" target on Windows,
> it just compiles to a .dll and a .lib, which you then *manually* move
> to someplace.
>
> For pkg-config to be useful, Qwt (or any other project) would need to
> provide a qwt.pc file which the user would have to edit to fill in the
> prefix, libdir and includedir fields.
>
> I am not saying pkg-config is useless on Windows. I believe it is very
> useful but only if combined with an installer. Something as simple as
> a .bat which asks the user where to install the libraries and includes
> would make pkg-config useful on Windows.
No, pkg-config on Windows has special behaviour. Please read the
section "Windows specialties" in the pkg-config manpage:
"If a .pc file is found in a directory that matches the usual conventions
(i.e., ends with \lib\pkgconfig), the prefix for that package is assumed to
be the grandparent of the directory where the file was found, and the pre‐
fix variable is overridden for that file accordingly.
In addition to the PKG_CONFIG_PATH environment variable, the Registry keys
HKEY_CURRENT_USER\Software\pkgconfig\PKG_CONFIG_PATH and
HKEY_LOCAL_MACHINE\Software\pkgconfig\PKG_CONFIG_PATH can be used to specify
directories to search for .pc files. Each (string) value in these keys is
treated as a directory where to look for .pc files."
The pkg-config libdir and includedir variables should always depend on the
prefix variable, anyway.
So even a ZIP file will work fine. Maybe add a README for with instruction to
set PKG_CONFIG_PATH correctly.
HS
More information about the CMake
mailing list