Ubuntu – Default installation prefix QT5 / QT5 Widgets Ubuntu

14.04cmakeqt5

I have a CMake project. I am trying to switch from QT4 to QT5.

 find_package(QT5Widgets REQUIRED) EDIT HERE IS A TYPO problem solved (Qt5... instead of QT5...)

already gives me

By not providing "FindQT5Widgets.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"QT5Widgets", but CMake did not find one.
Could not find a package configuration file provided by "QT5Widgets" with
any of the following names:

QT5WidgetsConfig.cmake
qt5widgets-config.cmake

Add the installation prefix of "QT5Widgets" to CMAKE_PREFIX_PATH or set
"QT5Widgets_DIR" to a directory containing one of the above files.  If
"QT5Widgets" provides a separate development package or SDK, be sure it
has been installed.

I did install the Ubuntu package via:

  sudo apt-get install qt5-default

While I know that the file QT5WidgetsConfig.cmake is contained in

/usr/lib/x86_64-linux-gnu/cmake/Qt5Widgets/

I dont know how to set "QT5Widgets_DIR" to this folder. As this is anyway the solution I dont prefer, I would like to set CMAKE_PREFIX_PATH to the installation folder.

But I dont have a clue where I need to link to. Tried so far:

set (CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/cmake/Qt5Widgets/")

Same error.

I tried to get information via

dpkg -L qt5-default

which prints

/usr
/usr/share
/usr/share/doc
/usr/share/doc/qt5-default
/usr/share/doc/qt5-default/copyright
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/qtchooser
/usr/share/doc/qt5-default/LGPL_EXCEPTION.txt
/usr/share/doc/qt5-default/changelog.Debian.gz
/usr/lib/x86_64-linux-gnu/qtchooser/default.conf

Where/how do I have look for the right path?

Regards
Jan

Best Answer

For linux,

Download and install qt5 from their website

then change the CMAKE_PREFIX_PATH by

$ CMAKE_PREFIX_PATH="{Path of gcc_64 under recently installed qt folder, example: $HOME/qt5/5.7/gcc_64}"
Related Question