Library "not found" after building test with CMake on Ubuntu.

I had the same issue today and this is the solution I found. I need to specify both commands for it to work in a non-default install directory:

cmake -DCMAKE_INSTALL_PREFIX=/opt/VTK -DCMAKE_INSTALL_RPATH=/opt/VTK/lib -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE /opt/VTK-src

Now I can include VTK and ldd finds all libraries!