我正在尝试将仅 header 的库转换为块。该库已经使用CMake,并包含测试和示例程序。我已经阅读过biicode文档,但不清楚如何为现有项目创建模块。我很困惑应该执行bii init -L
还是bii cpp:configure
。我尝试在biicode.conf中将Boost指定为要求,但得到WARN: Removing unused reference to "biicode/boost: 0"
请让我知道为现有项目创建块的步骤,谢谢。
最佳答案
您应该开始在库文件夹中使用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的问题。