cmake does not find qt 5.1.1

℡╲_俬逩灬. 提交于 2019-11-28 23:37:15
lpapp

You need to set the CMAKE_PREFIX_PATH to the Qt installation.

See http://doc.qt.io/qt-5/cmake-manual.html

I successly build my GUI on MacOSX 10.10 by exporting Linux environment variables

$ brew install qt5
$ ls /usr/local/opt/qt5/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake
$ /usr/local/opt/qt5/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake
$ export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/
$ cd ./build
$ cmake ../CMakeLists.txt
$ make -j8

Acroding to http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_PREFIX_PATH.html, the cmake function FIND_LIBRARY() will appends /lib to each of the directories. So done.

Fixed it with the following in a CMakeLists.txt file:

set(CMAKE_PREFIX_PATH $ENV{HOME}/Qt5.5.0/5.5/gcc_64)

For me, the context ended up something like:

# Ubuntu 14.04 LTS, CMake 2.8.12.2
wget http://download.qt.io/official_releases/qt/5.5/5.5.0/qt-opensource-linux-x64-5.5.0.run
chmod u+x qt-opensource-linux-x64-5.5.0.run
./qt-opensource-linux-x64-5.5.0.run
# Follow GUI prompts, installed to default location
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!