我正在尝试将仅限标头的库转换为块。该库已经使用CMake并包含测试和示例程序。我已经阅读了biicode文档,但不清楚如何为现有项目创建块。我是否应该bii init -L
或bii cpp:configure
感到困惑。我尝试在biicode.conf中指定Boost作为要求,但获取WARN: Removing unused reference to "biicode/boost: 0"
请让我知道为现有项目创建阻止的步骤,谢谢。
答案 0 :(得分: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。
有关使用提升的问题 - biicode has a boost repository in github。