How can LD_LIBRARY_PATH be changed within CMake?

后端 未结 3 439
伪装坚强ぢ
伪装坚强ぢ 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:02

    When you use this solution:

    SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
    

    Remembter to set the RPATH before defining the targets in your CMake-File. So this instruction have to be before add_executable() or add_library() is called, otherwise it has no effect.

提交回复
热议问题