<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>How to set gcc option "-Wl,-rpath-link," ?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hi everybody,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">how can I set the gcc option "-Wl,-rpath-<B>link</B>," with CMake?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I've tried the following, but I always end up with "-Wl,-rpath," only:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"># RPATH settings for linking shared libraries</FONT>
<BR><FONT SIZE=2 FACE="Arial"># skip the full RPATH for the build tree</FONT>
<BR><FONT SIZE=2 FACE="Arial">SET(CMAKE_SKIP_BUILD_RPATH TRUE)</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"># when building, use the install RPATH already</FONT>
<BR><FONT SIZE=2 FACE="Arial"># (so it doesn't need to relink when installing)</FONT>
<BR><FONT SIZE=2 FACE="Arial">SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) </FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"># the RPATH to be used when installing</FONT>
<BR><FONT SIZE=2 FACE="Arial">#SET(CMAKE_INSTALL_RPATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:${ACE_ROOT}/lib:${LIBXML_2_ROOT}/lib:${LIBXML_PP_ROOT}/lib:${LOG4_CXX_ROOT}/lib:${RUBY_ROOT}/lib")</FONT></P>
<P><FONT SIZE=2 FACE="Arial"># add the automatically determined parts of the RPATH</FONT>
<BR><FONT SIZE=2 FACE="Arial"># which point to directories outside the build tree to the install RPATH</FONT>
<BR><FONT SIZE=2 FACE="Arial">SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I also found somebody using the following, but the used variable seems to be deprecated as I could not find it in the current CMake documentation:</FONT></P>
<P><FONT SIZE=2 FACE="Arial">SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Best Regards,</FONT>
<BR><FONT SIZE=2 FACE="Arial">Joerg</FONT>
</P>
</BODY>
</HTML>