Reputation: 168
I use boost.build for my project. Of course, I use boost itself. Also, for test purposes I use google-test library with my project. I have to link my project with google-test's static library. I've found the workaround to do that for MinGW (for linux's gcc works too)
exe foo : $(IMPORTANT_PART) $(TEST_UTILITY_PART) : <toolset>gcc <linkflags>"../../libs/gtest-1.6.0/libs/gtest_main.a" <linkflags>-static <linkflags>-lpthread ;
It looks kind of ugly but it works. The rule for msvc looks much much more ugly
exe foo : $(IMPORTANT_PART) $(TEST_UTILITY_PART) : <toolset>msvc <linkflags>/LIBPATH:../../libs/gtest-1.6.0/libs <linkflags>/DEFAULTLIB:gtest_main-mdd.lib
<linkflags>/DEFAULTLIB:gtestd-md.lib
;
Is there more natural way to link target with external static library in boost.build project file.
P.S. Of cource using google-test and boost mix smells not good, but anyway there are a lot of external libraries that cover areas boost doesn't cover.
TIA
Upvotes: 3
Views: 732
Reputation: 168
Great! Thank the persond who pointed me http://www.boost.org/boost-build2/doc/html/bbv2/tutorial/prebuilt.html page. (the comment disappeared) It seems to be, I did read this page not carefully. And target lib with file property does the thing I searched for. Thanks!
As for using google test and boost build I did this way: I made Jamfile for google-test. It is very simple:
gtest.lib/Jamfile
project gtest_main
: requirements <include>../../../libs/gtest-1.6.0/include
<include>../../../libs/gtest-1.6.0/
: source-location ../../../libs/gtest-1.6.0
: build-dir ../../../libs/gtest-1.6.0/bin.b2 ;
lib gtest_main : src/gtest_main.cc src/gtest-all.cc : <link>static ;
Then, somewhere in my project file:
use-project /gtest : ./gtest.lib ;
and mentioning //gtest in project's requirements section.
Upvotes: 1