这种类似的问题LZ前前后后碰到了好几次,这里贴出其中一种,其他也都是类似的解决方法。
CMake Error at src/Ui/CMakeLists.txt:15 (FIND_PACKAGE):
Could not find module FindQT5.cmake or a configuration file for package
QT5.
Adjust CMAKE_MODULE_PATH to find FindQT5.cmake or set QT5_DIR to the
directory containing a CMake configuration file for QT5. The file will
have one of the following names:
QT5Config.cmake
qt5-config.cmake
CMake Error at src/Ui/CMakeLists.txt:17 (INCLUDE):
include called with wrong number of arguments. Include only takes one
file.
-- Directory /root/workspace/CenDVC/src/Ui
CMake Error at src/Ui/CMakeLists.txt:40 (QT5_WRAP_UI):
Unknown CMake command "QT5_WRAP_UI".
-- Configuring incomplete, errors occurred!
解决方案,LZ比较笨,只会用比较笨的办法解决,如果小伙伴有比较好的方法,可以评论或者私信LZ。
如果找不到Qt5WidgetsConfig.cmake
直接用搜索,找到对应文件位置,然后在CMakeLists.txt中设定对应路径
set(Qt5Widgets_DIR /path to qt/5.9.5/gcc_64/lib/cmake/Qt5Widgets)
find_package(Qt5Widgets)
类似的问题也是这么解决,原理同上,知道LZ的方法很原生态。。。
还有一个,就是有可能小伙伴们在qt的路径下找不到gcc_64这个文件夹,这是在qt安装的时候,没有选上Desktop gcc 64-bit的安装包,重新安装下qt,选择对应的Desktop gcc 64-bit,然后在对应的安装路径下就能找到对应的gcc_64文件夹了。感觉自己攒了好多笔记没写,今天就慢慢补一下,攒了一堆草稿纸都不能扔O(∩_∩)O哈哈~