Search code examples
c++visual-studiopreprocessor-directivepropertysheet

How can I include a preprocessor directive in a property sheet


I have built a project that will require a specific #define.

The directions for building that project say "When compiling your project, make sure to #define BLAH".

I would like to make a property sheet and place this directive in the property sheet, so that the people who build a project will not have to worry about it, will just include the property sheet.

Is it possible to place an include directive in a property sheet, and how would that be written ?

Thank you.


Solution

  • <?xml version="1.0" encoding="utf-8"?> 
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
      <PropertyGroup Label="UserMacros" />
      <PropertyGroup />
      <ItemDefinitionGroup>
        <ClCompile> 
          <PreprocessorDefinitions>BLAH;%(PreprocessorDefinitions)</PreprocessorDefinitions>    
        </ClCompile>
      </ItemDefinitionGroup>  
      <ItemGroup />
    </Project>