Boost logo

Boost-Build :

Subject: Re: [Boost-build] cxxflags bug ?
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2012-07-26 07:51:44


On 26 July 2012 12:32, bganesh05_at_[hidden] <bganesh05_at_[hidden]> wrote:
> Hi,
>
> Yes, that's what is my concern.

Please, read the MSDN. There is nothing to be concerned about.

> But t I do not want /O2 to appear again.

Just ignore it.

> To suppress it, I added <toolset>msvc,<variant>release:<cxxflags>"/Ox /Oi /GF
> /Gy " in project requirements in Jamroot, but /O2 is still coming in the
> command line.

The /Ox will override the /O2.

> I assumed that if I don't <optimization>speed, then /O2 won't come.

Don't assume. Read the docs.

> But seems like something is broken in bjam and so even though
> <optimization>speed is not given, /O2 appears in cmdline.

Nothing is broken.
You can specify the same option for cl.exe dozens of times in a single
invocation:

"If two options specify contradictory or incompatible directives, the directive
specified or implied in the option farthest to the right on the
command line is used."

http://msdn.microsoft.com/en-us/library/8k3f51f1(v=vs.100).aspx

For example:

g:\workshop\testcpp\test>cl /EHsc /MDd /MD /MDd /MDd /MT /MD test.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x8
Copyright (C) Microsoft Corporation. All rights reserved.

cl : Command line warning D9025 : overriding '/MDd' with '/MD'
cl : Command line warning D9025 : overriding '/MD' with '/MDd'
cl : Command line warning D9025 : overriding '/MDd' with '/MT'
cl : Command line warning D9025 : overriding '/MT' with '/MD'
test.cpp
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

/out:test.exe
test.obj

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net

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