I am developing a Qt application that I need to distribute. I need to ensure that the distributed application links at runtime against Qt version 4.8.1, but my application binary always depends on Qt 4, which points to a different version on my machine.
I have installed on my machine both Qt 4.6.2 (default Qt version installed for my Linux distribution) and Qt 4.8.1 (the one I need for my application), both in /usr/lib. The ideal solution I am searching for is specifying somehow in my CMakeLists.txt that I need my binary needs a specific Qt version to work. I tried with
find_package(Qt4 4.8.1 COMPONENTS QtCore QtGui REQUIRED)
but my output for
ldd executableName
is still
libQtOpenGL.so.4 => /usr/lib/libQtOpenGL.so.4
which points to the default (wrong) 4.6.2 Qt version. I would like to get if possible
libQtOpenGL.so.4.8.1 => /usr/lib/libQtOpenGL.so.4.8.1
So my binary can run properly and the default Qt version installed remains untouched.
Thank you.