Order of link directories

David Faure faure at kde.org
Fri Feb 2 23:11:48 CET 2007


On Friday 02 February 2007, Alexander Neundorf wrote:
> On Friday 02 February 2007 21:46, David Faure wrote:
> > What makes up the order of the link directories with cmake?
> > `cmake --help-command link_directories` doesn't mention what happens when
> > calling it multiple times, and I also don't know where builddir/lib gets
> > added to the link directories.
> 
> As soon as you say 
> target_link_libraries(someapp somelib)
> and "somelib" is built in the same build, the directory where the library is 
> created is added to the link path.
> Finally there is some clever sorting algorithm in cmake which tries to get the 
> order right.
For some definition of clever, since it gets it wrong here ;)

> Maybe the 
> link_directories (${KDE4_LIB_DIR})
> in the top level CMakeLists.txt isn't a good idea and should be removed. Can 
> you please try that ?
Indeed, it works!

I get this order now, though:
-L/usr/local/lib -L/d/kde/build/4/kdepim/lib -L/d/kde/src/4/qt-copy/lib -L/usr/lib64 -L/d/kde/inst/kde4/lib
This means that any kde stuff in /usr/lib64 (which is a symlink to /usr/lib) or in /usr/local/lib would
be preferred over the kde prefix I'm compiling against (/d/kde/inst/kde4/lib). This could create trouble 
with a kde4 installed by the distribution (not the case yet, but it will happen one day).

The correct order would be:
-L/d/kde/build/4/kdepim/lib  (local stuff first)
-L/d/kde/inst/kde4/lib    (the kde I'm compiling against)
-L/d/kde/src/4/qt-copy/lib  (the qt I'm compiling against)
-L/usr/lib64               (the system libs)
[-L/usr/local/lib - not sure why we're automatically adding that one]

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


More information about the Kde-buildsystem mailing list