Carneiro
Carneiro

Reputation: 3509

Building a makefile based dependency in a boost-build (b2) project

I am using boost-build to build my project, but I have added a library as a dependency that is built using GNU make. If I build this library manually, I can link it to my project in boost build using this simple Jamfile:

lib hts
  : 
  : <link>static <file>lib/lib.a
  :
  : <include>lib_headers 
;

Is there a way to tell boost-build to run make on the directory if the lib/lib.a is not present there?

Upvotes: 1

Views: 388

Answers (1)

Carneiro
Carneiro

Reputation: 3509

With help from the Boost mailing list, we came together with this solution. First you create an action to build the library using make. Then you add a "make" target to teach boost-build how to create the static library using the action you've just created. Then you create an alias that boost-build can depend on and plays nicely with the rest of the Jamfile.

path-constant lib_dir : lib ;
actions external-make
{
  cd $(lib_dir) && make
}
make lib.a : : @external-make : <location>lib_dir ;
alias hts
  : lib.a
  : <link>static
  :
  : <include>lib_headers
;

in your build, you can use "hts" as a target for this library.

Upvotes: 1

Related Questions