I am using CMake to build a program on linux. The program compiles successfully and runs from the project build directory. The program is linked with a custom library in the dir
You should look at set_target_properties command and the property BUILD_WITH_INSTALL_RPATH
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:set_target_properties