5

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

1
  • Was a typo has to be find_package(Qt5Widgets REQUIRED) Jun 8, 2015 at 19:38

2 Answers 2

3

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}"
1

You are linking to the wrong place like I was. You have to set CMAKE_PREFIX_PATH where you installed Qt. In my case it was :

set(CMAKE_PREFIX_PATH $ENV{HOME}/Qt/5.5/gcc_64)

where $ENV{HOME} is the home directory

Hope it helps you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .