cmake-conan icon indicating copy to clipboard operation
cmake-conan copied to clipboard

RPATH issues in MWE with shared libraries dependencies.

Open gabyx opened this issue 3 years ago • 2 comments
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.

gabyx avatar Dec 06 '21 14:12 gabyx

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

czoido avatar Dec 29 '21 17:12 czoido

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...

gabyx avatar Dec 30 '21 21:12 gabyx