1、 QT_DIR找不到或者Qt6_DIR找不到
1> [CMake] C:/Users/Administrator/Desktop/test/Table
1> [CMake] CMake Error at C:\Users\Administrator\Desktop\test\Table\CMakeLists.txt:15 (find_package):
1> [CMake] Could not find a package configuration file provided by "QT" with any of
1> [CMake] the following names:
1> [CMake]
1> [CMake] Qt6Config.cmake
1> [CMake] qt6-config.cmake
1> [CMake] Qt5Config.cmake
1> [CMake] qt5-config.cmake
1> [CMake]
1> [CMake] Add the installation prefix of "QT" to CMAKE_PREFIX_PATH or set "QT_DIR" to
1> [CMake] a directory containing one of the above files. If "QT" provides a separate
1> [CMake] development package or SDK, be sure it has been installed.
1> [CMake]
1> [CMake]
1> [CMake] -- Configuring incomplete, errors occurred!
解决方式:项目->CMake设置->给QT_DIR设置路径
注意:如果不知道路径在哪,可以使用everything搜索Qt6Config.cmake
2、Qt6CoreTools/Qt6GuiTools找不到
1> [CMake] CMake Warning at F:/VS2019IDE/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
1> [CMake] By not providing "FindQt6CoreTools.cmake" in CMAKE_MODULE_PATH this project
1> [CMake] has asked CMake to find a package configuration file provided by
1> [CMake] "Qt6CoreTools", but CMake did not find one.
1> [CMake]
1> [CMake] Could not find a package configuration file provided by "Qt6CoreTools"
1> [CMake] (requested version 6.5.3) with any of the following names:
1> [CMake]
1> [CMake] Qt6CoreToolsConfig.cmake
1> [CMake] qt6coretools-config.cmake
1> [CMake]
1> [CMake] Add the installation prefix of "Qt6CoreTools" to CMAKE_PREFIX_PATH or set
1> [CMake] "Qt6CoreTools_DIR" to a directory containing one of the above files. If
1> [CMake] "Qt6CoreTools" provides a separate development package or SDK, be sure it
1> [CMake] has been installed.
1> [CMake] Call Stack (most recent call first):
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6WidgetsTools/Qt6WidgetsToolsDependencies.cmake:9 (find_dependency)
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6WidgetsTools/Qt6WidgetsToolsConfig.cmake:33 (include)
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:65 (find_package)
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6Widgets/Qt6WidgetsDependencies.cmake:34 (_qt_internal_find_tool_dependencies)
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake:40 (include)
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package)
1> [CMake] CMakeLists.txt:16 (find_package)
1> [CMake] CMake Warning at F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:65 (find_package):
1> [CMake] Found package configuration file:
1> [CMake]
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6WidgetsTools/Qt6WidgetsToolsConfig.cmake
1> [CMake]
1> [CMake] but it set Qt6WidgetsTools_FOUND to FALSE so package "Qt6WidgetsTools" is
1> [CMake] considered to be NOT FOUND. Reason given by package:
1> [CMake]
1> [CMake] Qt6WidgetsTools could not be found because dependency Qt6CoreTools could
1> [CMake] not be found.
1> [CMake]
1> [CMake] Call Stack (most recent call first):
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6Widgets/Qt6WidgetsDependencies.cmake:34 (_qt_internal_find_tool_dependencies)
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake:40 (include)
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package)
1> [CMake] CMakeLists.txt:16 (find_package)
1> [CMake] CMake Warning at F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package):
1> [CMake] Found package configuration file:
1> [CMake]
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake
1> [CMake]
1> [CMake] but it set Qt6Widgets_FOUND to FALSE so package "Qt6Widgets" is considered
1> [CMake] to be NOT FOUND. Reason given by package:
1> [CMake]
1> [CMake] Qt6Widgets could not be found because dependency Qt6WidgetsTools could not
1> [CMake] be found.
1> [CMake]
1> [CMake] Configuring with -DCMAKE_FIND_DEBUG_MODE=TRUE might reveal details why the
1> [CMake] package was not found.
1> [CMake]
1> [CMake] Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
1> [CMake] of the path variables that find_package uses to try and find the package.
1> [CMake]
1> [CMake] Call Stack (most recent call first):
1> [CMake] CMakeLists.txt:16 (find_package)
1> [CMake] CMake Error at C:\Users\Administrator\Desktop\test\Table\CMakeLists.txt:16 (find_package):
1> [CMake] Found package configuration file:
1> [CMake]
1> [CMake] F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake
1> [CMake]
1> [CMake] but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
1> [CMake] FOUND. Reason given by package:
1> [CMake]
1> [CMake] Failed to find required Qt component "Widgets".
1> [CMake]
1> [CMake] Expected Config file at
1> [CMake] "F:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake"
1> [CMake] exists
1> [CMake]
1> [CMake]
1> [CMake]
1> [CMake] Configuring with -DCMAKE_FIND_DEBUG_MODE=TRUE might reveal details why the
1> [CMake] package was not found.
1> [CMake]
1> [CMake] Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
1> [CMake] of the path variables that find_package uses to try and find the package.
1> [CMake]
1> [CMake]
1> [CMake]
1> [CMake] -- Configuring incomplete, errors occurred!
操作方式和上面一致。