Re: [CMake] How to get RPATH option (-Wl, -rpath, /path/to/local/lib) ?
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 ! If you need to provide a pc file like this: >> more mylib.pc prefix=${CMAKE_INSTALL_PREFIX} exec_prefix=${prefix} includedir=${prefix}/include libdir=${exec_prefix}/lib Cflags: -I${includedir} Libs: -L${libdir} -lmylib The question is : how do you do when you need RPATH in the pc file ? Do you hard-code (this may not be portable) the rpath option : >> more mylib.pc prefix=${CMAKE_INSTALL_PREFIX} exec_prefix=${prefix} includedir=${prefix}/include libdir=${exec_prefix}/lib Cflags: -I${includedir} Libs: -Wl,-rpath, -L${libdir} -lmylib Or is there a specific variable to handle this ? Like for instance something like this >> more mylib.pc prefix=${CMAKE_INSTALL_PREFIX} exec_prefix=${prefix} includedir=${prefix}/include libdir=${exec_prefix}/lib Cflags: -I${includedir} Libs: ${CMAKE_RPATH_LINKER_OPTION}, -L${libdir} -lmylib - Mail original - > De: "Kris Thielemans" > À: "Franck Houssen" , "CMake Mail List" > > Envoyé: Vendredi 2 Février 2018 08:06:12 > Objet: RE: [CMake] How to get RPATH option (-Wl, -rpath, /path/to/local/lib) > ? > Hi > There a wiki page covering this > https://cmake.org/Wiki/CMake_RPATH_handling > 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. > 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 > https://github.com/CCPPETMR/SIRF/pull/79 > We seem to have found a solution using CMAKE_INSTALL_NAME_DIR but any other > help with that appreciated. > Kris > From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Franck Houssen > Sent: 01 February 2018 09:46 > To: CMake Mail List > Subject: Re: [CMake] How to get RPATH option (-Wl, -rpath, > /path/to/local/lib) ? > OK, so I believe I just need to write "-Wl,rpath" in my templates of pc/cmake > files !... > Franck > - Mail original - > > De: "Franck Houssen" < franck.hous...@inria.fr > > > > À: "CMake Mail List" < cmake@cmake.org > > > > Envoyé: Mercredi 31 Janvier 2018 10:39:51 > > > Objet: [CMake] How to get RPATH option (-Wl,-rpath,/path/to/local/lib) ? > > > How to get RPATH option (-Wl,-rpath,/path/to/local/lib) ? > > > 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. > > > 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) > > > Franck > > > -- > > > Powered by www.kitware.com > > > Please keep messages on-topic and check the CMake FAQ at: > > http://www.cmake.org/Wiki/CMake_FAQ > > > Kitware offers various services to support the CMake community. For more > > information on each offering, please visit: > > > CMake Support: http://cmake.org/cmake/help/support.html > > > CMake Consulting: http://cmake.org/cmake/help/consulting.html > > > CMake Training Courses: http://cmake.org/cmake/help/training.html > > > Visit other Kitware open-source projects at > > http://www.kitware.com/opensource/opensource.html > > > Follow this link to subscribe/unsubscribe: > > > https://cmake.org/mailman/listinfo/cmake > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake
Re: [CMake] How to get RPATH option (-Wl, -rpath, /path/to/local/lib) ?
Hi There a wiki page covering this https://cmake.org/Wiki/CMake_RPATH_handling 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. 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 https://github.com/CCPPETMR/SIRF/pull/79 We seem to have found a solution using CMAKE_INSTALL_NAME_DIR but any other help with that appreciated. Kris From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Franck Houssen Sent: 01 February 2018 09:46 To: CMake Mail List Subject: Re: [CMake] How to get RPATH option (-Wl, -rpath, /path/to/local/lib) ? OK, so I believe I just need to write "-Wl,rpath" in my templates of pc/cmake files !... Franck _ De: "Franck Houssen" mailto:franck.hous...@inria.fr> > À: "CMake Mail List" mailto:cmake@cmake.org> > Envoyé: Mercredi 31 Janvier 2018 10:39:51 Objet: [CMake] How to get RPATH option (-Wl,-rpath,/path/to/local/lib) ? How to get RPATH option (-Wl,-rpath,/path/to/local/lib) ? 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. 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) Franck -- Powered by www.kitware.com <http://www.kitware.com> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake
Re: [CMake] How to get RPATH option (-Wl, -rpath, /path/to/local/lib) ?
OK, so I believe I just need to write "-Wl,rpath" in my templates of pc/cmake files !... Franck - Mail original - > De: "Franck Houssen" > À: "CMake Mail List" > Envoyé: Mercredi 31 Janvier 2018 10:39:51 > Objet: [CMake] How to get RPATH option (-Wl,-rpath,/path/to/local/lib) ? > How to get RPATH option (-Wl,-rpath,/path/to/local/lib) ? > 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. > 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) > Franck > -- > Powered by www.kitware.com > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake