我想编译它,它需要Qt
5.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
既然它已经解决了你的问题,我就把它作为答案放在这里。稍后我将更详细地改进这一部分。
如果您正在使用cmake,请使用find_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.
如果您只想找到Qt模块,那么只需设置Qt5_DIR
ex: Qt5_DIR="/Users/bob/Qt/5.12.7/clang_64/lib/cmake/Qt5"
当使用CMake
构建时,您可以使用Qt5_DIR或CMAKE_PREFIX_PATH,两者都应该有效。
关于CMake建筑的更多解释可以在这里找到