2

I am generating VisualStudio C++ project files from a build system. The compiler options in the XML for the project file are in a different format from the command line options specified for the compiler.

I need to get from command line options for cl.exe to the project file options for the VCCLCompilerTool.

1 - Is anyone aware of an open source script designed to do exactly this?

2 - If one removes all the options from the XML and puts all the command line options into the "AdditionalOptions" attribute, will it filter these or is everything put in there added to the command line verbatim ? will the "AdditionalOptions" overide the defaults if there are options present from in the UI ? ( I havn't written a proxy cl.exe to test what it actually gets in this case :)

Thanks!!!!

1 Answers1

4

One solution could be to use Property Sheets (vsprops). You could generate a vsprops file for every option you intend to use (this is done from the property sheet editor in visual studio). Then in your generated project file reference each property sheet that contains the option(s) you intend to use in the InheritedPropertySheets seciton. We do something similar by grouping various options together into related propery sheets. For example we use the following sets of property sheets:

 ARMASM.rules
 C++ Standards Compliance.vsprops
 Debug Program Database.vsprops
 Debug.vsprops
 Multi-Threaded Debug Libraries.vsprops
 Multi-Threaded Release Libraries.vsprops
 Optimize for Size.vsprops
 Platform Directory.vsprops
 Release.vsprops
 Static Library.vsprops
 Strictest Warnings.vsprops
 Win32.vsprops
 WinCE.vsprops
Nic Strong
  • 6,532
  • 4
  • 35
  • 50
  • Thanks, Yes, property sheets are good for factoring things which are common to multiple .vcproj. They are the *same* format as the .vcproj file itself. The question is, the command line arguments for the "cl.exe" compiler are in a different format. VStudio has an internal translator from the .vcproj format (XML attributes) to the command line formats for both the various tools it supports. I was wondering if anyone has done a command line format to .vcproj format converter and/or vice versa, or if there is a maintainable easy way to do this. – Peter Kennard Sep 09 '09 at 21:25
  • Very interesting. if I wanted to integrate the fipslink.pl script from openssl into my build of a fips compliant exe, I'd rewrite the perl script in the macro language. Thanks. I hope this supports regex nicely. – Peter Kahn Feb 05 '10 at 22:08
  • How do you incorporate a .rules file inside a .vsprops? There's a bounty question for this by me here:http://stackoverflow.com/questions/1623609/vs2008-add-custom-build-rule-to-a-property-sheet-vsprops – shoosh Mar 25 '10 at 08:24