In visual studio, there is a way to exclude a source file from the build on a per-configuration basis (debug vs release). The actual VCPROJ looks like this when you exclude a CPP file from the build for only DEBUG configuration:<div>
<br></div><div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span><File</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>RelativePath="C:\Code\work\rdailey-t510-sandbox\n2\gpr\security\gtisecprovcleartext.cpp"></div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span><FileConfiguration</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>Name="Debug|Win32"</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>ExcludedFromBuild="TRUE"></div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span><Tool</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>Name="VCCLCompilerTool"/></div><div><span class="Apple-tab-span" style="white-space:pre">                                </span></FileConfiguration></div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span></File></div><div><br></div><div><br></div><div>Is there a way in CMake to make it generate this? There has to be some sort of platform agnostic feature for this, and for other platforms it will implement it accordingly</div>
<div><br></div><div>---------</div>Robert Dailey<br>
<br><br><div class="gmail_quote">On Wed, Oct 5, 2011 at 3:47 PM, Robert Dailey <span dir="ltr"><<a href="mailto:rcdailey@gmail.com">rcdailey@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>In my particular CMake project, I have three CPP files:</div><div><br></div><div> a.cpp</div><div> b.cpp</div><div> c.cpp</div><div><br></div><div>I want 'a.cpp' to be compiled in all configurations (release & debug).<br></div>
<div>I only want 'b.cpp' to be compiled in DEBUG configuration.<br></div><div>I only want 'c.cpp' to be compiled in RELEASE configuration.</div><div><br></div><div>How can I do this? I need something similar to the `debug` and `optimized` keywords that are accepted by the `target_link_libraries()` CMake operation.</div>
<div><br></div><div>---------</div>Robert Dailey<font color="#888888"><br>
</font></blockquote></div><br></div>