I have the following app being built and linked using CMake.
add_executable(my_node main.cpp)
target_link_libraries(my_node dynamic_lib my_dependency)
The source of my_node
DOES NOT use dynamic_lib
directly. my_dependency
requires dynamic_lib
to run.
Using readelf and ldd, I can see that dynamic_lib
is not found on my_node
; my app fails to launch. I can launch the app by instead setting LD_LIBRARY_PATH
.
LD_LIBRARY_PATH="/path/to/dynamic_lib_dir" bash -c './my_node'
Alternatively, if I use classes from dynamic_lib
in my_node
source, it all works. I think I'm missing some CMake configuration here to force my_node
to directly link with dynamic_lib
. How can I bundle all of this up neatly?