0

What property or other option can I set, to tell MSBuild to pass an arbitrary option to the C++ compiler?

In cases where the compiler is known to MSBuild or the option has the same spelling as one used by a known compiler e.g. How can I pass a parameter through MSBuild to the compiler? the solution is to set a property corresponding to that specific option. However, in this case the compiler I'm using is clang and the option is unique to clang.

The closest likely candidate I could find in the documentation is CompilerResponseFile but when I set that (whether in the project file on the command line) nothing at all happens; maybe that's specific to C# not C++?

Is there another property I can use instead?

Community
  • 1
  • 1
rwallace
  • 31,405
  • 40
  • 123
  • 242

1 Answers1

4

You can add AdditionalOptions metadata to the ClCompile items. For example,

<ItemDefinitionGroup>
    <ClCompile>
        <AdditionalOptions>Your Options Go Here %(AdditionalOptions)</AdditionalOptions>
    <ClCompile>
</ItemDefinitionGroup>
James McNellis
  • 348,265
  • 75
  • 913
  • 977