Reputation: 25307
I'm setting up a new computer as development machine and working with cmake that worked just fine on another computer.
I have installed Qt6 to my home directory, whereas on the old computer, it was installed into the /opt
directory.
Here is what CMakeLists.txt file looks like:
set(Qt_DIR "~/Qt/6.1.2/gcc_64/lib/cmake/")
set(Qt_version 6)
...
find_package(Qt${Qt_version} COMPONENTS Core Widgets REQUIRED)
That fails with following error message:
CMake Error at GUI/CMakeLists.txt:72 (find_package):
Found package configuration file:
/home/menkaur/Qt/6.1.2/gcc_64/lib/cmake/Qt6/Qt6Config.cmake
but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
FOUND. Reason given by package:
Failed to find Qt component "Widgets" config file at ""
The file ~/Qt/6.1.2/gcc_64/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake
does exist
Is there some additional configuration that I'm supposed to have had done?
Upvotes: 4
Views: 8737
Reputation: 121
Qt needs some package to be installed to work to install dependencies type the following code and get working
sudo apt-get install build-essential libgl1-mesa-dev
Upvotes: 12
Reputation: 458
The Trolltech installer does not check for dependencies during installation, instead the dependencies are checked in find_package(qt_module)
. And if the dependencies are not found, then find_package(qt_module)
will fail without error messages. Thus, you should make sure that the system has all the required development libraries.
Upvotes: 3
Reputation: 458
Don't use set(Qt_DIR "~/Qt/6.1.2/gcc_64/lib/cmake/")
, run cmake with -DCMAKE_PREFIX_PATH=~/Qt/6.1.2/gcc_64
.
Upvotes: 4