【发布时间】:2020-05-14 14:25:08
【问题描述】:
我正在尝试将我的 QT 项目集成到我的 CLION 项目中。 在这种情况下,我遇到了 CMAKE 和 QT 集成的问题。 我的 CmakeList.txt 的内容是:
cmake_minimum_required(VERSION 3.12)
project(BD2_PROYECTO_1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_PREFIX_PATH "/Users/jonathanprieto/Qt5.13.0/5.13.0/")
find_package(Qt5Widgets REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
add_executable(BD2_PROYECTO_1 parser.cpp parser.h main.cpp statichashing.cpp statichashing.h randomfile.cpp randomfile.h record.cpp record.h transactions.cpp transactions.h ui/input.cpp ui/input.h ui/ui_dialog.h ui/mainwindow.h ui/mainwindow.cpp ui/mainwindow.ui ui/ui_input.ui ui/input.h ui/dialog.ui)
target_link_libraries(helloworld Qt5::Widgets)
但我收到以下错误:
CMake Error at CMakeLists.txt:8 (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.
有人可以帮我吗?
谢谢
【问题讨论】:
-
有
/Users/jonathanprieto/Qt5.13.0/5.13.0/lib/cmake吗?如果是这样,that 应该是您的 CMAKE_PREFIX_PATH。另外,你可以通过brew安装Qt 就好了。 -
无关:
find_package(Qt5 COMPONENTS Widgets REQUIRED)允许您在需要时一次指定多个组件。 -
我没有lib目录,只有clang_64、ios、src,还有很多版本的android。
-
我找到了解决方案!路径是:/Users/jonathanprieto/Qt5.13.0/5.13.0/clang_64/lib/cmake