[cmake-developers] Wrongly assuming lib/ is IsImplicitDirectory for runtime-paths

Patrick Boettcher patrick.boettcher at posteo.de
Mon May 15 03:28:58 EDT 2017


Hi list,

This is a follow-up of my problem I discussed with myself on the
cmake-mailing list: "CLANG vs GCC when linking executables".

I found the root-cause of this problem:

When constructing the rpath-arguments cmake is using an
cmOrderDirectories called OrderLinkerSearchPath to which all
the runtime-libraries via AddRuntimeLibrary() have been added.

In AddRuntimeLibrary() it checks whether the library-path is an
implicit directory.

To this list somewhere the lib/-path located next to the
compiler-bin/-path has been added.

This works well if the compiler is installed in /usr/bin
because /usr/lib is present in the system's loader-configuration.

In my case I have locally built a compiler and in the lib/-dir next to
the bin/-dir I installed other libraries. When now linking with one of
them (via an IMPORTED library), cmake does not add the rpath because it
assumes lib/ is implicitly used by the loader (or something else?).

What can I do? Is this a bug in cmake or in my setup? Why is this path
considered implicit?

best regards,
--
Patrick.


More information about the cmake-developers mailing list