Par*_*avi 2 linux qt cmake qt5
我想编译这个,它需要Qt5.14,并且我从我的 Linux 存储库安装了 Qt 5.12。我刚刚从源代码编译了 Qt 并将其安装在/usr/local/Qt-6.0.0/(默认位置)。
但 CMake 打印以下错误,尽管我添加了set(CMAKE_PREFIX_PATH "/usr/local/Qt-6.0.0/include")和/或set(CMAKE_PREFIX_PATH "/usr/local/Qt-6.0.0/"):
The following configuration files were considered but not accepted:
/usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake, version: 5.12.8
/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake, version: 5.12.8
Run Code Online (Sandbox Code Playgroud)
既然已经解决了你的问题,我就把它作为答案放在这里。稍后我将更详细地改进此部分。
如果您使用 cmakefind_package来查找包,然后在稍后阶段链接到您的二进制文件。
In order for find_package to be successful, Qt 5 must be found below the
CMAKE_PREFIX_PATH, or the Qt5_DIR must be set in the CMake cache to the
location of the Qt5Config.cmake file. The easiest way to use CMake is to set the
CMAKE_PREFIX_PATH environment variable to the install prefix of Qt 5.
Run Code Online (Sandbox Code Playgroud)
如果您只想查找 Qt 模块,那么只需设置Qt5_DIR
ex: Qt5_DIR="/Users/bob/Qt/5.12.7/clang_64/lib/cmake/Qt5"
构建时CMake可以使用 Qt5_DIR 或 CMAKE_PREFIX_PATH,两者都应该可以工作。
| 归档时间: |
|
| 查看次数: |
10922 次 |
| 最近记录: |