How can LD_LIBRARY_PATH be changed within CMake?

后端 未结 3 419
伪装坚强ぢ
伪装坚强ぢ 2021-01-03 19:23

I have a local shared library which is not in $LD_LIBRARY_PATH. I want to run my executable, but since it cannot find the shared library in the system folders, it outputs \"

3条回答
  •  孤街浪徒
    2021-01-03 20:06

    You can set the runtime shared library search path using the -rpath linker option:

    SET(CMAKE_EXE_LINKER_FLAGS 
              "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,/usr/local/lib")
    

提交回复
热议问题