我正在设置一台新计算机作为开发机器,并使用在另一台计算机上运行良好的 cmake。
我已将 Qt6 安装到我的主目录中,而在旧计算机上,它已安装到该/opt
目录中。
这是 CMakeLists.txt 文件的样子:
set(Qt_DIR "~/Qt/6.1.2/gcc_64/lib/cmake/")
set(Qt_version 6)
...
find_package(Qt${Qt_version} COMPONENTS Core Widgets REQUIRED)
失败并显示以下错误消息:
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 ""
该文件~/Qt/6.1.2/gcc_64/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake
确实存在
我应该做一些额外的配置吗?