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

Same result for “locate” after “sudo updatedb”.

VTK and library X using VTK are compiled with

mkdir build
cd build
ccmake ..
make -j
sudo make install

Yesterday I got:

ldd ./myApplication
libvtkfreetype-8.2.so.1 => not found
libvtkglew-8.2.so.1 => not found
libvtkCommonSystem-8.2.so.1 => not found
libvtksys-8.2.so.1 => not found
libvtkFiltersGeometry-8.2.so.1 => not found
libvtkCommonComputationalGeometry-8.2.so.1 => not found
libvtkCommonSystem-8.2.so.1 => not found
libvtkCommonMisc-8.2.so.1 => not found
libvtksys-8.2.so.1 => not found

Today libraries are found. I dont really know why…

$ ldd ./ground_truth_gen 
libvtkInteractionStyle-8.2.so.1 => /usr/local/lib/libvtkInteractionStyle-8.2.so.1 (0x00007f7e1a757000)
libvtkRenderingFreeType-8.2.so.1 => /usr/local/lib/libvtkRenderingFreeType-8.2.so.1 (0x00007f7e1a68b000)
libvtkRenderingOpenGL2-8.2.so.1 => /usr/local/lib/libvtkRenderingOpenGL2-8.2.so.1 (0x00007f7e1a2a1000)
libvtkRenderingCore-8.2.so.1 => /usr/local/lib/libvtkRenderingCore-8.2.so.1 (0x00007f7e19f0c000)
libvtkCommonDataModel-8.2.so.1 => /usr/local/lib/libvtkCommonDataModel-8.2.so.1 (0x00007f7e1989f000)
libvtkCommonMath-8.2.so.1 => /usr/local/lib/libvtkCommonMath-8.2.so.1 (0x00007f7e19873000)
libvtkCommonCore-8.2.so.1 => /usr/local/lib/libvtkCommonCore-8.2.so.1 (0x00007f7e18f2b000)

I dont know why it is suddenly running. I linked one of my several CMake tagets with -Wl,--enable-new-dtags which seemed to solve the problem. But this was no solution in my case as I also need the example tools build with library X. As these still failed, I deleted the extra flags in my CMakeList.txt.
These example tools still fail. I will look at this again.