<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>The wiki do not cover how to handle rpath when you need to provide a mylib.pc or mylib.cmake file in the install directory of your library: this is why I asked !<br></div><div><br></div><div>If you need to provide a pc file like this:<br></div><div>>> more mylib.pc <br>prefix=${CMAKE_INSTALL_PREFIX}<br>exec_prefix=${prefix}<br>includedir=${prefix}/include<br>libdir=${exec_prefix}/lib<br>Cflags: -I${includedir}<br>Libs: -L${libdir} -lmylib<br><br></div><div>The question is : how do you do when you need RPATH in the pc file ?<br></div><div><br></div><div>Do you hard-code (this may not be portable) the rpath option :<br></div><div>>> more mylib.pc <br>prefix=${CMAKE_INSTALL_PREFIX}<br>exec_prefix=${prefix}<br>includedir=${prefix}/include<br>libdir=${exec_prefix}/lib<br>Cflags: -I${includedir}<br>Libs: <strong>-Wl,-rpath,</strong>-L${libdir} -lmylib</div><div><br></div><div>Or is there a specific variable to handle this ? Like for instance something like this<br></div><div><br></div><div>>> more mylib.pc <br>prefix=${CMAKE_INSTALL_PREFIX}<br>exec_prefix=${prefix}<br>includedir=${prefix}/include<br>libdir=${exec_prefix}/lib<br>Cflags: -I${includedir}<br>Libs: <strong>${CMAKE_RPATH_LINKER_OPTION},</strong>-L${libdir} -lmylib</div><div><br></div><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>De: </b>"Kris Thielemans" <kris.f.thielemans@gmail.com><br><b>À: </b>"Franck Houssen" <franck.houssen@inria.fr>, "CMake Mail List" <cmake@cmake.org><br><b>Envoyé: </b>Vendredi 2 Février 2018 08:06:12<br><b>Objet: </b>RE: [CMake] How to get RPATH option (-Wl, -rpath, /path/to/local/lib) ?<br><div><br></div><style><!--
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><div class="WordSection1"><p class="MsoNormal"><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;">Hi</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;">There a wiki page covering this</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;"><a href="https://cmake.org/Wiki/CMake_RPATH_handling" target="_blank" data-mce-href="https://cmake.org/Wiki/CMake_RPATH_handling">https://cmake.org/Wiki/CMake_RPATH_handling</a></span><br data-mce-bogus="1"></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;"> </span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;">I find it a bit confusing (and the example code for the “full RPATH” option seems to set CMAKE_INSTALL_RPATH twice), but it should help. </span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;"> </span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;">It might be outdated for OSX as El Capitan introduced extra security requirements such that the recommendations on the wiki no longer seem to work. You can see some of our struggles with this here</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;"><a href="https://github.com/CCPPETMR/SIRF/pull/79" target="_blank" data-mce-href="https://github.com/CCPPETMR/SIRF/pull/79">https://github.com/CCPPETMR/SIRF/pull/79</a></span><br data-mce-bogus="1"></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;">We seem to have found a solution using CMAKE_INSTALL_NAME_DIR but any other help with that appreciated.</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;"> </span></p><p class="MsoNormal"><a name="_MailEndCompose" class="mceItemAnchor"></a><span style="mso-fareast-language:EN-US" data-mce-style="mso-fareast-language: EN-US;">Kris</span></p><span style="mso-bookmark:_MailEndCompose" data-mce-style="mso-bookmark: _MailEndCompose;"></span><div><div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm" data-mce-style="border: none; border-top: solid #E1E1E1 1.0pt; padding: 3.0pt 0cm 0cm 0cm;"><p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> CMake [mailto:cmake-bounces@cmake.org] <b>On Behalf Of </b>Franck Houssen<br><b>Sent:</b> 01 February 2018 09:46<br><b>To:</b> CMake Mail List <cmake@cmake.org><br><b>Subject:</b> Re: [CMake] How to get RPATH option (-Wl, -rpath, /path/to/local/lib) ?</span></p></div></div><p class="MsoNormal"> </p><div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Arial',sans-serif; color: black;">OK, so I believe I just need to write "-Wl,rpath" in my templates of pc/cmake files !...</span></p></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Arial',sans-serif; color: black;"> </span></p></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Arial',sans-serif; color: black;">Franck</span></p></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Arial',sans-serif; color: black;"> </span></p></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Arial',sans-serif; color: black;"> </span></p></div><div class="MsoNormal" style="text-align:center" data-mce-style="text-align: center;" align="center"><hr id="zwchr" size="5" align="center" width="100%"></div><blockquote style="border:none;border-left:solid #1010FF 1.5pt;padding:0cm 0cm 0cm 4.0pt;margin-left:3.75pt;margin-top:5.0pt;margin-bottom:5.0pt" data-mce-style="border: none; border-left: solid #1010FF 1.5pt; padding: 0cm 0cm 0cm 4.0pt; margin-left: 3.75pt; margin-top: 5.0pt; margin-bottom: 5.0pt;"><p class="MsoNormal"><b><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;">De: </span></b><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;">"Franck Houssen" <<a href="mailto:franck.houssen@inria.fr" target="_blank" data-mce-href="mailto:franck.houssen@inria.fr">franck.houssen@inria.fr</a>><br><b>À: </b>"CMake Mail List" <<a href="mailto:cmake@cmake.org" target="_blank" data-mce-href="mailto:cmake@cmake.org">cmake@cmake.org</a>><br><b>Envoyé: </b>Mercredi 31 Janvier 2018 10:39:51<br><b>Objet: </b>[CMake] How to get RPATH option (-Wl,-rpath,/path/to/local/lib) ?</span></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;"> </span></p></div><div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Times New Roman',serif; color: black;">How to get RPATH option (-Wl,-rpath,/path/to/local/lib) ?</span></p></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Times New Roman',serif; color: black;"> </span></p></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Times New Roman',serif; color: black;">I would like to create a *.pc/cmake file for users to find a library I provide. As there is possibly a LOT of dependencies (libraries) I may not even be able to list, the most simple way to do that is to use RPATH. I know that for gcc, RPATH is set with "-Wl,-rpath". But what about others compilers (pgi, icc) ? This option could not be the same.</span></p></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Times New Roman',serif; color: black;"> </span></p></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Times New Roman',serif; color: black;">Is it possible to "grab" the correct RPATH option (-Wl,-rpath) according to the compiler ? Something like a CMAKE_RPATH_OPTIONS to substitute in a *.pc/cmake.in template file ? (to create a *.pc/cmake file in the install directory using configure_file)</span></p></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Times New Roman',serif; color: black;"> </span></p></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Times New Roman',serif; color: black;">Franck</span></p></div></div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;"><br>-- </span></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;"> </span></p></div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;">Powered by <a href="http://www.kitware.com" target="_blank" data-mce-href="http://www.kitware.com">www.kitware.com</a></span><br data-mce-bogus="1"></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;"> </span></p></div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;">Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank" data-mce-href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a></span><br data-mce-bogus="1"></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;"> </span></p></div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;">Kitware offers various services to support the CMake community. For more information on each offering, please visit:</span></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;"> </span></p></div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;">CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank" data-mce-href="http://cmake.org/cmake/help/support.html">http://cmake.org/cmake/help/support.html</a><br>CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank" data-mce-href="http://cmake.org/cmake/help/consulting.html">http://cmake.org/cmake/help/consulting.html</a><br>CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank" data-mce-href="http://cmake.org/cmake/help/training.html">http://cmake.org/cmake/help/training.html</a></span><br data-mce-bogus="1"></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;"> </span></p></div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;">Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank" data-mce-href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a></span><br data-mce-bogus="1"></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;"> </span></p></div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Helvetica",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Helvetica',sans-serif; color: black;">Follow this link to subscribe/unsubscribe:<br><a href="https://cmake.org/mailman/listinfo/cmake" target="_blank" data-mce-href="https://cmake.org/mailman/listinfo/cmake">https://cmake.org/mailman/listinfo/cmake</a></span><br data-mce-bogus="1"></p></blockquote><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black" data-mce-style="font-size: 12.0pt; font-family: 'Arial',sans-serif; color: black;"> </span></p></div></div></div></blockquote><div><br></div></div></body></html>