Skip to content

Instantly share code, notes, and snippets.

View asklar's full-sized avatar

Alexander Sklar asklar

View GitHub Profile
@asklar
asklar / Preprocess.targets
Created May 19, 2020 03:01
Preprocess C++ to file
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Preprocess">
<Message Condition="'$(Source)'!=''" Text="Preprocessing: $(Source)"/>
<Error Condition="'$(Source)'==''" Text="To generate a pre-processed file, please specify a source file with msbuild /p:Source=nameOfTheSource.cpp"/>
<CL PreprocessToFile="true" Sources="$(Source)"
AdditionalIncludeDirectories="%(ClCompile.AdditionalIncludeDirectories)"
PreprocessorDefinitions="%(ClCompile.PreprocessorDefinitions)"
AdditionalOptions="%(ClCompile.AdditionalOptions) /d1PP"
PreprocessKeepComments="true"