开发者

MSBuild VS2010 and /Zc:auto option

I upgrade our dev. environment from VS 2008 to VS 2010. We compile more than 1000 C++ projects. All from the command line. One of the problem is a heavy usage of word "auto" in our code base. VS 2010 by default doesn't allow it even in function names like auto_close, etc. Using /Zc:auto- option resolves this issue.

My question is: What is the right way to have MSBuild to pass /Zc:auto option to the cl.exe? I tried: "/p:C开发者_StackOverflowlCompile_AdditionalOptions=Zc:auto-" but still compilation fails. If I add /Zc:auto- option manually to the project properties - at Configuration Properties / C/C++ /CommandLine / AdditionalOptions then project is compiling well.

The problem that I can't edit manually 1000s of projects.

I try to use following command line: msbuild "/t:Build" "/p:Configuration=Release" "/p:UseEnv=true" "/p:AdditionalOptions=Zc:auto-" "myproject.vcxproj"


Supplying /Zc:auto- option via MSBuild would mean the IDE cannot be used to compile any of the projects in question, but maybe that doesn't bother you. If the existing projects are not all using property sheets, you can use the default one added to all VS2010 vcxproj files:

%LOCALAPPDATA%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props

This property sheet should be included in all your vcxproj projects. To add the option with the IDE, open one of your projects and then:

View -> Other Windows -> Property Manager -> Debug | Win32 -> Microsoft.Cpp.Win32.User -> Properties -> Common Properties -> C/C++ -> Command Line -> Additional Options: /Zc:auto-

and then save and exit the IDE. This section will have been added to that file:

<ItemDefinitionGroup>
  <ClCompile>
    <AdditionalOptions>/Zc:auto- %(AdditionalOptions)</AdditionalOptions>
  </ClCompile>
</ItemDefinitionGroup>

and will apply to all your C++ projects.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜