cmake-conan
cmake-conan copied to clipboard
RPATH issues in MWE with shared libraries dependencies.
trafficstars
Does anybody know what the Problem in this MWE is.
https://stackoverflow.com/questions/70246332/cmake-not-adding-full-rpath-on-macos
I am grateful for any input.
Hi @gabyx, Please check Conan docs about this:
- https://docs.conan.io/en/latest/howtos/manage_shared_libraries/rpaths.html
- https://docs.conan.io/en/latest/howtos/manage_shared_libraries/env_vars.html
Conan will not add absolute paths by default but you can later use a VirtualRunEnv generator to set
PATH,LD_LIBRARY_PATH, etc... So in your example, just adding that generator:
conan_cmake_configure(REQUIRES fmt/6.1.2
OPTIONS fmt:shared=True
GENERATORS cmake_find_package VirtualRunEnv)
And after building activating that environment: source conanrun.sh
Should be enough.
Hope this helps
Thanks! That helps. However, its still kind of hard to find a good way to make a cmake install selfcontaining and rellocatable on all platforms, and also having a cmake build where targets run without any problem... favoring a solution which works for both problems...