I tried to use the QtQuickCompiler the first time, so I looked in the Qt docs. (https://doc.qt.io/QtQuickCompiler/qquickcompiler-building-with-cmake.html). But if I call find_package(Qt6QuickCompiler) it shows me,
By not providing "FindQt6QuickCompiler.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt6QuickCompiler", but CMake did not find one.
Could not find a package configuration file provided by "Qt6QuickCompiler"
with any of the following names:
Qt6QuickCompilerConfig.cmake
qt6quickcompiler-config.cmake
Add the installation prefix of "Qt6QuickCompiler" to CMAKE_PREFIX_PATH or
set "Qt6QuickCompiler_DIR" to a directory containing one of the above
files. If "Qt6QuickCompiler" provides a separate development package or
SDK, be sure it has been installed.
After this I searched the Qt directory, but I did not find it. Is there no QtQuickCompiler as of Qt6? Or what am I doing wrong?
Related
I downloaded the source code from git:https://github.com/MITK/MITK, but when I tried to config the code in QT, it always shows the following issues:
/Users/cjz/CCode/MITK/CMakeLists.txt:211: error: By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5", but CMake did not find one. Could not find a package configuration file provided by "Qt5" (requested version 5.6.0) with any of the following names: Qt5Config.cmake qt5-config.cmake Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR" to a directory containing one of the above files. If "Qt5" provides a separate development package or SDK, be sure it has been installed.
I checked on the Internet and was told that I should set CMAKE_PREFIX_PATH=qtbase
since my qt was installed at "/Users/cjz/Qt5.9.2", I set CMAKE_PREFIX_PATH=/Users/cjz/Qt5.9.2
but the problem remains the same.
I also tried cmake .. -DCMAKE_PREFIX_PATH=/Users/cjz/Qt5.9/
but it did not work either.
I totoally have no idea how to adress this problem, anyone helps me? thank you.
Follow Qt documentation for installing from sources? here : General Installation Information
For Linux, Follow this guide:
Qt for Linux/X11 - Building from Source
I just recently upgraded to Qt 5.7 and I am trying to build a project that needs to find several packages. I am on a mac also recently upgraded to el capitan. I have set CMAKE_PREFIX_PATH in my .bash_profile and I have checked the environment to verify that it is correct. When I do a cmake . on the folder my project is in (previously this was how I built) it gives me several errors such as:
CMake Warning at CMakeLists.txt:79 (FIND_PACKAGE):
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.
However I have already verified that the path is correct and that the files do indeed exist. I have tried several variations of cmake_prefix_path, for instance:
CMAKE_PREFIX_PATH=/Users/mnicholson/Qt/5.7/clang_64/
as well as
CMAKE_PREFIX_PATH=/Users/mnicholson/Qt/5.7/clang_64/lib/cmake/
but neither seems to work despite the fact that the cmake files are there. With older versions of qt setting the path worked, however since upgrading from 5.5 to 5.6 and then to 5.7 I'm baffled... HELP!! Is this a qt5.7 problem? El capitan?
Thanks!
Try find_package PATHS option. Something like
find_package(Qt5Widgets
CONFIG
PATHS /Users/mnicholson/Qt/5.7/clang_64/lib/cmake/Qt5Widgets
NO_DEFAULT_PATH)
I'm trying to build a Qt Quick Controls application with CMake. I use the following documentation:
http://doc.qt.io/QtQuickCompiler/qquickcompiler-building-with-cmake.html
When running CMake, I'm getting this error:
By not providing "FindQt5QuickCompiler.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt5QuickCompiler", but CMake did not find one.
Could not find a package configuration file provided by "Qt5QuickCompiler"
with any of the following names:
Qt5QuickCompilerConfig.cmake
qt5quickcompiler-config.cmake
at this line:
FIND_PACKAGE(Qt5QuickCompiler)
Obviously CMake doesn't find Qt5QuickCompiler. I checked in my Qt folder (C:\Qt) but it's not there. Yet I could run this application with QMake.
What do I need to set in order to find Qt5QuickCompiler?
I just stumbled upon the same issue with Qt 5.12 under Linux. The documentation under https://doc.qt.io/QtQuickCompiler/qquickcompiler-building-with-cmake.html currently seems to be wrong.
Use QuickCompiler after COMPONENTS in the Qt5 find_package instead of trying to add it via find_package(Qt5QuickCompiler). Adapting the example from the link, use
find_package(Qt5 COMPONENTS Quick Core Network QuickCompiler)
qtquick_compiler_add_resources(RESOURCES example.qrc)
add_executable(myapp ${SRC_LIST} ${RESOURCES)
instead of
find_package(Qt5 COMPONENTS Quick Core Network)
find_package(Qt5QuickCompiler)
qtquick_compiler_add_resources(RESOURCES example.qrc)
add_executable(myapp ${SRC_LIST} ${RESOURCES)
The error is pretty clear: CMake doesn't have a module for the Qt5QuickCompiler to find it. It just doesn't know what it is. I've just checked the corresponding cmake folder and it doesn't have that file. I'm not sure what that Qt documentation page is talking about but there is no such a file in the CMake distribution. Maybe Qt sources have this file somewhere?
You need to build Qt5 with Qt Quick compiler which you can download from http://www.qt.io/qt-quick/. In the build directory of Qt Quick compiler, you will find Qt5QuickCompilerConfig.cmake.
Copy the path to this directory, and add to CMAKE_PREFIX_PATH like this
cmake -DCMAKE_PRFEIX_PATH=<pathToFile> <pathToSrcDirOfYourProject>
I have already installed Qt5. I get the following error when I run cmake on the build files of an application.
CMake Error at CMakeLists.txt:12 (find_package):
By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5" with any of
the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.
I understand I need to specify a path. Can any 1 please help me with the exact command of what I need to write and in which file do I need to change this? I am a newbie so please answer in detail and not refer any links. I can find the location of Qt5Config.cmake.
Thanks in advance.
I'm trying to create a CMakeLists.txt file which tries finding Qt5, and if that fails, tries falling back to a Qt4 installation. The script works so far, but I'll always get a warning if Qt5 is not installed.
Note that FindQt5.cmake is supplied by Qt5 and will not be available if only Qt4 is installed.
The basic structure is like this:
cmake_minimum_required(VERSION 2.8.11)
message("-- Searching for Qt5")
find_package(Qt5 COMPONENTS Core Xml Network)
if (Qt5_FOUND)
message("-- Searching for Qt5 - found version ${Qt5Core_VERSION}")
else (Qt5_FOUND)
message("-- Searching for Qt5 - not found")
# ...
endif (Qt5_FOUND)
The warning message in case Qt5 is not installed (or not set up properly) is the following:
By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Qt5", but CMake did not find one.
Could not find a package configuration file provided by "Qt5" with
any of the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set
"Qt5_DIR" to a directory containing one of the above files.If
"Qt5" provides a separate development package or SDK, be sure it has
been installed.
Is there a way to suppress this warning?
I'll also accept other ways to detect if Qt5 is installed or not.
In order to suppress the warning, the QUIET keyword can be used:
find_package(Qt5 COMPONENTS Core Xml Network QUIET)
find_package has CONFIG and MODULE arguments to tell cmake how to search for the package.
http://www.cmake.org/cmake/help/v3.0/command/find_package.html
http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html
Add the CONFIG keyword.