如何根据当前的构建配置指定要编译的.cpp文件?

man*_*eak 1 c++ visual-studio

我的项目中有多个构建配置,我想根据当前选择的配置交换一些.CPP文件.我如何在Visual Studio 2013中执行此操作?

Dmi*_*sov 5

在GUI中,查看cpp文件的属性,并为排除它的配置将"Excluded From Build"设置为yes.

在项目文件中看起来像:

<ClCompile Include="my_platform_specific_file.cpp">
    <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
            true
    </ExcludedFromBuild>
</ClCompile>
Run Code Online (Sandbox Code Playgroud)