c++ - 如何将第 3 方 (C++) 依赖项添加到 BUCK 文件?

标签 c++ build buck

我用 Buck 构建我的项目。如何向项目添加外部(非 Buck)库?

我的例子 BUCK:

cxx_binary(
    name="my_project",
    srcs=[
         "my_file.cpp",
    ],
    deps=[
        "boost_system",
        "boost_filesystem",
    ],
    compiler_flags=['-w',
                    '-Ddef',
                    '-Ipath',
                    ])

但是是错误的: 构建失败://my_proj:my_project: 参数 'deps': 无法强制 'boost_system' 类 com.facebook.buck.model.BuildTarget

最佳答案

使用prebuilt_cxx_library:

prebuilt_cxx_library(
    name="boost_system",
    lib_dir='../otherlibs'
)

prebuilt_cxx_library(
    name="boost_filesystem",
    lib_dir='../otherlibs'
)     

........
deps=[
    ":boost_system",
    ":boost_filesystem",
],
.......

关于c++ - 如何将第 3 方 (C++) 依赖项添加到 BUCK 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46516132/

相关文章:

python - 应用于共享数据类型的递归在 python 中出错

c++ - 为什么在 C 程序中从 main() 返回 0?

java - Maven 将项目打包为具有依赖项的可执行 JAR

c++ - 如何在多个 GIT 存储库中组织大型项目?

android - OkBuck 和 Realm 的问题

android - Buck 和 Android Material 主题

C++ : 2-D Pointer Array Sorting: Selection Sort doesn't work for certain instance

c++ - 将字符数组写入特定的内存地址

c++ - 包括 .cpp 而不是 header(.h)

ios - 我们可以限制 Swift 生成的接口(interface)只能在 Xcode 中从模块访问吗?