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>&lt;File</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>RelativePath=&quot;C:\Code\work\rdailey-t510-sandbox\n2\gpr\security\gtisecprovcleartext.cpp&quot;&gt;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>&lt;FileConfiguration</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>Name=&quot;Debug|Win32&quot;</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>ExcludedFromBuild=&quot;TRUE&quot;&gt;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>&lt;Tool</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>Name=&quot;VCCLCompilerTool&quot;/&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>&lt;/FileConfiguration&gt;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>&lt;/File&gt;</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">&lt;<a href="mailto:rcdailey@gmail.com">rcdailey@gmail.com</a>&gt;</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 &#39;a.cpp&#39; to be compiled in all configurations (release &amp; debug).&lt;br&gt;</div>

<div>I only want &#39;b.cpp&#39; to be compiled in DEBUG configuration.&lt;br&gt;</div><div>I only want &#39;c.cpp&#39; 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>