gpt4 book ai didi

meson-build - 介子 : how to make find_library() works with an unusual path?

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

我的 Meson项目我有一个位于“不寻常”位置的依赖项:

/opt/MyDependence/lib/libmyLib.so
/opt/MyDependence/include/myLib.hpp

我的介子文件是:
project('Test', ['cpp'])

cpp = meson.get_compiler('cpp')
myLib_dep = cpp.find_library('myLib', required: true)

显然介子找不到图书馆
Meson.build:5:0: ERROR: C++ library 'myLib' not found

问题是我不知道添加额外搜索路径的“规范”方式,以便 Meson 可以找到我的库。任何的想法?

更新:请注意,即使我使用:
meson --libdir=/opt/MyDepedence/lib build

我收到此错误消息:
meson.build:1:0: ERROR: The value of the 'libdir' option is '/opt/MyDepedence/lib' which must be a subdir of the prefix '/usr/local'.
Note that if you pass a relative path, it is assumed to be a subdir of prefix.

最佳答案

find_library现在有一个可选参数 dirs (自 0.53.0 起),它指示在其中查找程序名称的绝对路径的额外列表。

cpp = meson.get_compiler('cpp')
myLib_dep = cpp.find_library('myLib', dirs: '/opt/MyDepedence/lib', required: true)

关于meson-build - 介子 : how to make find_library() works with an unusual path?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59769986/

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