My OS is Ubuntu. I would like to change from QT4 to QT5 in my project. The native package though is 4.x version in Ubuntu right now.
I have downloaded the Linux installer from QT homepage and installed QT5.4 under /opt/Qt/5.4/
This path is not found by
find_package (Qt5 REQUIRED)
I tried adding
set(CMAKE_MODULE_PATH "/opt/QT/5.4;${CMAKE_MODULE_PATH}")
to my CMAKELIST.txt
but that does not help.
Where do I have to link, or am I using the wrong syntax?
Some edits after hint with calling:
cmake -DCMAKE_PREFIX_PATH=/opt/QT/5.4/gcc_64/ ../src/
I also have deleted the CMAKE_MODULE_PATH variable. I still get the same error:
CMake Error at CMakeLists.txt:3 (find_package):
Found package configuration file:
/usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake
but it set Qt5_FOUND to FALSE so package "Qt5" is considered to be NOT
FOUND. Reason given by package:
The Qt5 package requires at least one component
I dont know why this is happening after reading https://blogs.kde.org/2008/12/12/how-get-cmake-find-what-you-want-it . There it is stated, that the path will be searched before the default search directories. The path I used seems to be right now:
/opt/QT/5.4/gcc_64/
Adding subfolder gcc_64 must be right, as this subfolder has "lib", "include" ect as subfolders.
I remeber that I have called also
sudo apt-get install QT5-default
some time ago. This did not help, I needed the installer from QT. Although I removed qt5-default again to prevent cmake from finding the wrong package configuration file, the same error appears.
See discussion below, moved to here: Cmake and QT5 - Include only takes one argument