【问题标题】:Creating a block for a header-only library为仅标头库创建块
【发布时间】:2015-05-01 14:07:10
【问题描述】:

我正在尝试将仅包含标头的库转换为块。该库已经使用 CMake 并包含测试和示例程序。我已经阅读了 biicode 文档,但不清楚如何为现有项目创建块。我很困惑是应该做bii init -L 还是bii cpp:configure。我尝试在 biicode.conf 中将 Boost 指定为要求,但得到 WARN: Removing unused reference to "biicode/boost: 0"

请告诉我为现有项目创建块的步骤,谢谢。

【问题讨论】:

    标签: c++ boost biicode


    【解决方案1】:

    您应该开始在库文件夹中使用bii init -L。然后,following this steps on the docs,使用bii deps 命令检查未解决的依赖关系,调整 biicode.conf 文件(如果需要),并添加外部依赖关系。

    同时调整您当前的 CMakeLists.txt 与:

    IF(BIICODE)
       INCLUDE("biicode.cmake")
       RETURN()
    ENDIF()
    

    biicode.cmake 文件中至少应该有ADD_BII_TARGETS(),因为你依赖于Boost,你的应该看起来像下面的代码,here's a guide explaining how depend on Boost

    #Include the biicode Boost setup script
    include(biicode/boost/setup)
    
    ADD_BII_TARGETS()
    
    #Setup Boost and build (if needed) the required Boost components
    #Since lambda is header-only, there are no components to build and find
    bii_find_boost()
    
    #Add Boost headers to the block include directories
    target_include_directories(${BII_BLOCK_TARGET} INTERFACE ${Boost_INCLUDE_DIRS})
    

    运行bii find 检索依赖项,运行bii configure 将其配置为您当前的配置并使用bii build 构建。检查common issues building in the docs here

    对于使用 boost 的问题 - biicode has a boost repository in github

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-31
      • 2020-10-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多