我刚刚升级到Qt 5.7,我正在尝试构建一个需要查找多个软件包的项目。我最近也升级到el capitan。我在.bash_profile中设置了CMAKE_PREFIX_PATH,并检查了环境以验证它是否正确。当我做一个cmake。在我的项目所在的文件夹中(以前这是我的构建方式)它给了我几个错误,例如:
CMake Warning at CMakeLists.txt:79 (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.
但是我已经验证了路径是正确的并且文件确实存在。我尝试过cmake_prefix_path的几种变体,例如:
CMAKE_PREFIX_PATH=/Users/mnicholson/Qt/5.7/clang_64/
以及
CMAKE_PREFIX_PATH=/Users/mnicholson/Qt/5.7/clang_64/lib/cmake/
但是,尽管cmake文件存在,但似乎都不起作用。随着旧版本的qt设置路径工作,但是从5.5升级到5.6然后升级到5.7我感到困惑......帮助!这是qt5.7问题吗? El capitan?
谢谢!
答案 0 :(得分:2)
尝试find_package
PATHS选项。像
find_package(Qt5Widgets
CONFIG
PATHS /Users/mnicholson/Qt/5.7/clang_64/lib/cmake/Qt5Widgets
NO_DEFAULT_PATH)