I have two versions of the same library libabc.so
, I have to link my program to one version, and load another version when it's executed (loader should load another library when executable is run).
I place the two versions in different paths, how can I specify that using cmake?
I hope I have made myself clear, thank you.
@Tsyvarev's comments basically gives the answer, here's a bit more detail.
Say the two versions for link and load are placed in link_path/libabc.so
and load_path/libabc.so
, the CMakeLists.txt
should be like
...
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH load_path;${CMAKE_INSTALL_RPATH}) # load path
...
target_link_libraries(xxx link_path/libabc.so) # link path
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.