Boost logo

Boost-Build :

From: Zbynek Winkler (zwin_at_[hidden])
Date: 2004-01-09 13:07:11


Hello. I was trying to add <define>_DEBUG for <variant>debug and
<define>NDEBUG for <variant>release. The way I did it was to add to the
root Jamfile the following:

project
: requirements
<variant>debug:<define>_DEBUG
<variant>release:<define>NDEBUG
;

Is this the proper way to do this? I just wanted the respected builds to
be build with the defines. However I've found out that sometimes both
symbols are defined - i.e. when I request debug variant with
optimization (example attached). Is this the expected behavior or a bug?

Zbynek

--
$ b debug optimization=speed
...found 10 targets...
...updating 3 targets...
msvc.compile.c++ bin\msvc\debug\optimization-speed\test.obj
test.cpp
test.cpp(2) : fatal error C1189: #error : "Both _DEBUG and NDEBUG defined."
call "c:\program files\microsoft visual
studio\vc98\bin\vcvars32.bat" > nul
cl /Zm800 -nologo -TP -DNDEBUG -D_DEBUG /Z7 /Ogity /O2 /Gs /Ob0 /GX
/GR /MDd -c -Fo"bin\msvc\d
ebug\optimization-speed\test.obj" "test.cpp"
...failed msvc.compile.c++ bin\msvc\debug\optimization-speed\test.obj...
...failed updating 1 target...
 --------------000400030101050003090805 Content-Type: text/plain;
name="Jamfile"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Jamfile"
project 
: requirements 
<variant>debug:<define>_DEBUG
<variant>release:<define>NDEBUG
;
exe test : test.cpp ;
 --------------000400030101050003090805 Content-Type: text/plain;
name="project-root.jam"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="project-root.jam"
 --------------000400030101050003090805 Content-Type: text/plain;
name="test.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="test.cpp"
#if defined(_DEBUG) && defined(NDEBUG)
#error "Both _DEBUG and NDEBUG defined."
#endif
#if defined(_DEBUG) 
#pragma message("_DEBUG defined.")
#elif defined(NDEBUG)
#pragma message("NDEBUG defined.")
#else
#error "Neither _DEBUG nor NDEBUG defined."
#endif
int main() { return 0; }
 --------------000400030101050003090805-- 

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