我的项目(在C中)在构建时具有第三方依赖.但是,默认情况下,第三方库安装到/ opt /而不是/ lib,我在pkg-config中找不到它.从mesonbuild的文档中,我应该使用declare_dependency,我没有其源代码将其视为我的子项目.如果我使用dependency()来定义它,我找不到正确的参数来定义自定义位置.
如何声明非标准第三方库的依赖关系?
如
here和
here所述
The main use case for this [
declare_dependency()
] is in subprojects.
和
[
dependency()
] finds an external dependency … withpkg-config
[or] library-specific fallback detection logic …
相反,您可以使用编译器提供的find_library()
对象和include_directories()
. find_library()返回一个对象,就像declare_dependency()返回一样. include_directories()返回包含目录的opaque对象.
假设您使用的是C编译器,并且您的第三方库及其头文件是/opt/hello/libhello.so和/opt/hello/hello.h,您可以执行以下操作:
project('myproj','c') cc = meson.get_compiler('c') lib_hello = cc.find_library('hello',dirs : ['/opt/hello']) inc_hello = include_directories('/opt/hello') exec = executable('app','main.c',dependencies : [lib_hello],include_directories : inc_hello)
原文地址:https://www.jb51.cc/javaschema/281270.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。