I get these following errors during build of a file using CMake:
CMake Warning at CMakeLists.txt:33 (FIND_PACKAGE):
By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Core", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Core" with any of the following names:
Qt5CoreConfig.cmake
qt5core-config.cmake
Anybody know how to solve this? Thanks in advance
In order for find_package to be successful, Qt 5 must be found below the CMAKE_PREFIX_PATH, or the Qt5_DIR must be set in the CMake cache to the location of the Qt5WidgetsConfig. cmake file. The easiest way to use CMake is to set the CMAKE_PREFIX_PATH environment variable to the install prefix of Qt 5.
This time, I found a Qt6Config. cmake there (inside C:\Qt\6.3. 1\msvc2019_64\lib\cmake\Qt6).
Maybe, you should try to add the proper path to the CMAKE_PREFIX_PATH
variable in the environment or config.
export CMAKE_PREFIX_PATH=path_to/Qt/5.9/clang_64:$CMAKE_PREFIX_PATH
Replace path_to
with your real path.
You should find the cmake packages in your Qt installation in:
<install_prefix>/lib/cmake
Assuming <install_prefix>
is the root path of your installation. Set the variable Qt5_DIR to <install_prefix>/lib/cmake/Qt5
in your configuration and cmake should be able to find all the modules
One possible cause for this error message is outdated CMake code like [1]
find_package(Qt5Core REQUIRED).
Then there is a good chance for solving the problem by changing to
find_package(Qt5 COMPONENTS REQUIRED Core).
[1] http://cmake.3232098.n2.nabble.com/debugging-CMAKE-PREFIX-PATH-td7596290.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With