2

I am trying to convert a header-only library into a block. The library already uses CMake and contains test and example programs. I've gone through biicode documentation but not clear how to create block for existing project. I am confused whether I should do bii init -L or bii cpp:configure. I tried specifying Boost as requirement in biicode.conf but getting WARN: Removing unused reference to "biicode/boost: 0"

Please let me know the steps to create block for existing project, thanks.

TomCho
  • 3,204
  • 6
  • 32
  • 83
Sivachandran
  • 787
  • 7
  • 21

1 Answers1

1

You should start using bii init -L inside the library's folder. Then, following this steps on the docs, check for unresolved dependencies with bii deps command, adapt biicode.conf file (if needed), and add the external dependencies.

Also adapt your current CMakeLists.txt with:

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

biicode.cmake file should at least have ADD_BII_TARGETS() in it, as you're depending on Boost, yours should look like the code below, 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})

Run bii find to retrieve the depencencies and bii configure to configure it to your current config and build with bii build. Check common issues building in the docs here.

For issues using boost - biicode has a boost repository in github.

amalulla
  • 481
  • 2
  • 7