Boost logo

Boost-Build :

Subject: Re: [Boost-build] Creating a top-level property that expands differently for subprojects
From: Gregory Symons (gsymons_at_[hidden])
Date: 2011-01-13 13:53:08

On Thu, 2011-01-13 at 11:37 -0600, Gregory Symons wrote:
> Hi,
> I have a project set up with several subprojects. I'm using Google Test
> for unit testing, and have set up unit-test targets in each subproject
> similar to the following:
> path-constant root-path : . ;
> unit-test test_util : [ glob *_test.cpp ] libs gtest_main :
> <testing.arg>"--gtest_output=xml:"root-path/test_detail.xml ;
> What I'd like to do is specify the testing.arg property as a requirement
> on the root project, but have it expand to something unique for each
> subproject.
> Something along the lines of:
> project root : requirements
> <testing.arg>"--gtest_output=xml:"$(subproject_dir)/test_detail.xml ;
> where $(subproject-dir) is expanded to the directory or project id for
> each subproject in turn; i.e. when building the util subproject it
> expands to "util", and when building the common subproject it expands to
> "common". Is there a way to do this? I can't quite seem to find it in
> the docs, and I'm afraid I don't grok enough to even guess
> at what the shape of the right answer is.
> Thanks for any help you can give me,

Thanks to volodya for helping me on IRC. The solution he steered me
towards wound up like this, and it accomplishes what I need. It also let
me get rid of some redundancy in the source list, too:)

I added a rule to my Jamroot that wrapped unit-test:

rule google-test ( target : source * : properties * )
   unit-test $(target) : $(source) gtest//gtest_main : $(properties)
<testing.arg>"--gtest_output=xml:"$(target)_results.xml ;

Then where I was doing unit-test, I just use my new google-test rule.

Thanks again!

Gregory Symons <gsymons_at_[hidden]>
DrillingInfo <>

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at