rwallace
rwallace

Reputation: 33455

Getting MSBuild to pass an arbitrary option to the compiler

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?

Upvotes: 0

Views: 778

Answers (1)

James McNellis
James McNellis

Reputation: 355157

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

<ItemDefinitionGroup>
    <ClCompile>
        <AdditionalOptions>Your Options Go Here %(AdditionalOptions)</AdditionalOptions>
    <ClCompile>
</ItemDefinitionGroup>

Upvotes: 4

Related Questions