[CMake] Problems with implicit directories

Tyler Roscoe tyler at cryptio.net
Fri Nov 13 12:35:42 EST 2009


On Fri, Nov 13, 2009 at 12:21:53PM -0500, Bill Hoffman wrote:
> The problem should go away if you use the full path to the library.

I hope this advice helps the OP. Maybe it will.


I don't think it will help with my problem, however, since I already do
use a fully-qualified path to my libs. Here is an email I was planning
to send to the list but which I never got back to (sorry for highjacking
your thread, Aslund):

My product uses zlib, libpng, and Qt. We used to link against libpng and
zlib statically, but now we link against the shared libraries because
static libraries are gross and because we discovered that Qt was using
its own static version of libpng. This created a version mismatch in my
product and broke PNG-related functionality.

We then rebuilt Qt and told it to link dynamically against the "system"
libpng instead. That resolved the version mismatch problem, but now each
library in my product that links against Qt produces this warning:

> CMake Warning at
> /chehalis/tylermr/autobuild/common/trunk/_build/util/HelperMacros.cmake:592
> (add_library):
>   Cannot generate a safe runtime search path for target
>   [a library in my project that uses Qt] because files in some directories may
> conflict
>   with libraries in implicit directories:
>
>     runtime library [libpng12.so.0] in /usr/lib64 may be hidden by
>     files
> in:
>       /3rdpartylibs/png/1.2.35/build/linux/release/lib
>     runtime library [libz.so.1] in /usr/lib64 may be hidden by files
>     in:
>       /3rdpartylibs/zlib/1.2.3/build/linux/release/lib
>
>   Some of these libraries may not be found correctly.

I think my problem has something to do with the transitive linking that
CMake calculates. That is, it sees that my library needs some Qt
library, so then it tries to figure out what that Qt library needs. The
Qt library needs libpng, so it looks around and finds libpng in /usr/lib
(note that my /3rdpartylibs/png/... location is not in LD_LIBRARY_PATH
or anything like that). But then when it goes to compile my library, it
has two different libpngs to contend with, and throws the warning.

If my analysis of why this is happening is correct, can someone suggest
a way to de-confuse CMake and quell the warning?

Thanks,
tyler


More information about the CMake mailing list