So here was my final solution since it appears that composite features are expanded in stages resulting in duplications of the expansions (final expansion was <test>A <test>E <define>_TEST=0 <define>_TEST=4):
import feature ;
feature.feature test : E A B C D ;
project : requirements <test>A : <define>_TEST=0
<test>B : <define>_TEST=1
<test>C : <define>_TEST=2
<test>D : <define>_TEST=3
<test>E : <define>_TEST=4 ;
exe main : main.c : <test>A ; # uses A
exe main1 : main.c ; # uses E
From: Nogradi, Chris
Sent: Monday, April 09, 2012 12:22 PM
To: 'Boost.Build developer's and user's list'
Subject: RE: default value for composite feature always used
So I tried this instead:
import feature ;
feature.feature test : E A B C D : composite optional ;
feature.compose <test>A : <define>_TEST=0 ;
feature.compose <test>B : <define>_TEST=1 ;
feature.compose <test>C : <define>_TEST=2 ;
feature.compose <test>D : <define>_TEST=3 ;
feature.compose <test>E : <define>_TEST=4 ;
project : default-build <test>E ;
exe main : main.c : <test>A ;
Which appears to work per my requirements but now the no-op build time is 3x-4x what it was before (for my real build not the example above)???
Anyone have a better idea?
Chris
From: Nogradi, Chris
Sent: Monday, April 09, 2012 10:17 AM
To: Boost.Build developer's and user's list
Subject: default value for composite feature always used
Hello,
I am doing the following:
import feature ;
feature.feature test : E A B C D : composite ;
feature.compose <test>A : <define>_TEST=0 ;
feature.compose <test>B : <define>_TEST=1 ;
feature.compose <test>C : <define>_TEST=2 ;
feature.compose <test>D : <define>_TEST=3 ;
feature.compose <test>E : <define>_TEST=4 ;
exe main : main.c : <test>A ;
And for some reason, _TEST=4 is always set even though I am specifying that <test>A
(_TEST=0 is also set) should be used. I am obviously misunderstanding the documentation regarding the default value of test since I would have expected it to not be used in this case. Can someone explain why this is happening and how I can have a default
value set when <test> is not specified but when it is specified, have it use the specified value not the default?
$ boost-build/bin/bjam.exe -d2 -a
...found 11 targets...
...updating 3 targets...
file bin\msvc-8.0\debug\test-A\threading-multi\main.obj.rsp
"main.c" -Fo"bin\msvc-8.0\debug\test-A\threading-multi\main.obj" -TC /Z7 /Od /Ob0 /W3 /GR /MDd /Zc:forScope /Zc:wchar_t -c
-D_TEST=0
-D_TEST=4
compile-c-c++ bin\msvc-8.0\debug\test-A\threading-multi\main.obj
call "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 >nul
cl /Zm800 -nologo @"bin\msvc-8.0\debug\test-A\threading-multi\main.obj.rsp"
main.c
file bin\msvc-8.0\debug\test-A\threading-multi\main.exe.rsp
"bin\msvc-8.0\debug\test-A\threading-multi\main.obj"
msvc.link bin\msvc-8.0\debug\test-A\threading-multi\main.exe
call "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DEBUG /MACHINE:X86 /subsystem:console /out:"bin\msvc-8.0\debug\test-A\threading-multi\main.exe" @"bin\msvc-8.0\debug\test-A\threading-multi\main.exe.rsp"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
msvc.manifest bin\msvc-8.0\debug\test-A\threading-multi\main.exe
if exist "bin\msvc-8.0\debug\test-A\threading-multi\main.exe.manifest" (
call "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 >nul
mt -nologo -manifest "bin\msvc-8.0\debug\test-A\threading-multi\main.exe.manifest" "-outputresource:bin\msvc-8.0\debug\test-A\threading-multi\main.exe;1"
)
...updated 3 targets...
Thanks,
Chris