gpt4 book ai didi

cmake - 如何仅在cmake中匹配主要版本

转载 作者:行者123 更新时间:2023-12-04 15:05:07 25 4
gpt4 key购买 nike

我正在尝试构建一个需要 LLVM 11 作为依赖项的项目。他们捆绑了一份 LLVM 11.0.1。我想针对系统版本构建它,即 LLVM 11.1.0。在 cmake 构建文件中,它们具有:

find_package(LLVM 11.0 CONFIG)

如果您尝试使用系统 LLVM,您会收到以下错误:

CMake Warning at 3rdparty/llvm.cmake:42 (find_package):
Could not find a configuration file for package "LLVM" that is compatible
with requested version "11.0".

The following configuration files were considered but not accepted:

/usr/lib/llvm/11/lib64/cmake/llvm/LLVMConfig.cmake, version: 11.1.0
/usr/lib/llvm/11/lib/cmake/llvm/LLVMConfig.cmake, version: 11.1.0

Call Stack (most recent call first):
3rdparty/CMakeLists.txt:436 (include)

我认为将行更改为这样可以解决问题:

find_package(LLVM 11 CONFIG)

但它没有,我得到了完全相同的错误:

CMake Warning at 3rdparty/llvm.cmake:42 (find_package):
Could not find a configuration file for package "LLVM" that is compatible
with requested version "11".

The following configuration files were considered but not accepted:

/usr/lib/llvm/11/lib64/cmake/llvm/LLVMConfig.cmake, version: 11.1.0
/usr/lib/llvm/11/lib/cmake/llvm/LLVMConfig.cmake, version: 11.1.0

Call Stack (most recent call first):
3rdparty/CMakeLists.txt:436 (include)

我错过了什么?这是代码的完整链接:https://github.com/RPCS3/rpcs3/blob/master/3rdparty/llvm.cmake

最佳答案

一个版本是否被认为与所请求的版本兼容由您要查找的包指定。我没有查看 LLVM 配置,但我怀疑它指定只有确切的版本兼容,而不是具有相同主要版本的所有版本。

如果您运行的是 CMake 3.19 或更高版本,您可以将版本范围传递给 find_package , 所以你可以试试 find_package(LLVM 11...<12 CONFIG)相反。

关于cmake - 如何仅在cmake中匹配主要版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66305592/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com