[CMake] new RPATH support questions
Alexander Neundorf
a.neundorf-work at gmx.net
Tue Mar 7 13:33:13 EST 2006
> Von: Brad King <brad.king at kitware.com>
...
> CMake has no way to know what the proper RPATH is for external
> libraries
> in the installed binaries. Again, take my example of using a separate
> Qt build tree. KDE would build and install with an rpath pointing at
> the Qt build tree instead of the installed Qt.
>
> CMake is providing an interface to get whatever RPATHs you want into
> the installed binary. It is is up to a project's code to produce the
> proper path for its distribution. Only the project authors know how
> the binaries will finally be distributed and where other libraries will
> be located.
Well, ok.
But how should I do this in practise ?
I could add QT_LIBRARY_DIR, no problem.
We use xml2, gif, jpeg, jasper, dnssd, zlib, xslt, png, bzip2, cups, agg,
libart, pcre and others.
When compiling, cmake nicely adds all the RPATH for all these libs
installed on the system. To find them out, I would have to manually get
the directory component of all used libs and add them to the
INSTALL_RPATH variable. I don't see a way how to do this without much
manual work and fiddling around.
I would have to do this at the end of the top level CMakeLists.txt, and
make sure I don't forget any of the libraries used in the whole project.
This would suck.
Or I could do this for every target separatly. This means I will have to
add a bunch of not-so-simple cmake lines for every target.
add_executable(foo ${foo_SRCS})
set(foo_RPATH)
if (PNG_FOUND)
target_link_libraries(foo ${PNG_LIBRARIES})
# won't work, since PNG_LIBRARIES is a list
# maybe iterate over it ?
get_filename_component(png_RPATH ${PNG_LIBRARIES} PATH)
set (foo_RPATH ${foo_RPATH} ${png_RPATH} )
endif (PNG_FOUND)
if (PCRE_FOUND)
target_link_libraries(foo ${PCRE_LIBRARIES})
get_filename_component(pcre_RPATH ${PCRE_LIBRARIES} PATH)
set (foo_RPATH ${foo_RPATH} ${pcrepng_RPATH})
endif (PCRE_FOUND)
...
set_target_properties(foo PROPERTIES INSTALL_RPATH "${foo_RPATH}")
This wouldn't be nice, especially while OTOH cmake would have no problem
collecting these paths.
Bye
Alex
--
"Feel free" mit GMX FreeMail!
Monat für Monat 10 FreeSMS inklusive! http://www.gmx.net
More information about the CMake
mailing list