|
Boost-Build : |
From: Deane Yang (deane_yang_at_[hidden])
Date: 2007-04-04 14:11:47
Eric Niebler wrote:
> Konstantin Litvinenko wrote:
>> Hello, Eric!
>> You wrote on Tue, 03 Apr 2007 12:13:26 -0700:
>>
>> EN> This causes all of my tests to crash, because the tests are built with
>> EN> _HAS_ITERATOR_DEBUGGING=0, and the unit test framework is not. What I
>> EN> really need to do is build my *own* version of the unit test framework
>> EN> with this define, and link to that. But I don't know how to get the
>> EN> <define> requirement to propagate to the library.
>>
>> EN> Can anybody tell me the magic incantation?
>>
>> Try this
>>
>> import feature ;
>>
>> feature.feature iterator_debugging : on off : composite propagated optional
>> ;
>> feature.compose <iterator_debugging>off : <define>_HAS_ITERATOR_DEBUGGING=0
>> ;
>>
>> project
>> : requirements
>> <library>/boost/test//boost_unit_test_framework
>> <link>static
>> # MSVC-8's iterator debugging causes some tests to run forever.
>> <toolset>msvc-8.0:<iterator_debugging>off
>> ;
>>
>> test-suite "accumulators"
>> : [ run count.cpp ]
>> [ run covariance.cpp ]
>> ...
>> ;
>
>
> It works! You're a genius. And I see that puts the resulting lib in a
> special iterator_debugging-off/ subdirectory, so other tests that don't
> use this feature won't link to this special lib inadvertently. Very nice.
>
I agree. This is a very important tip that will help avoid linking
incompatible libraries together. The same problem caused me some major
headaches in the past.
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk