Awesome idea, +1<div><br></div><div>This is probably the best work-around until includes get a target property.<br clear="all"><div><br></div><div>---------</div>Robert Dailey<br>
<br><br><div class="gmail_quote">On Wed, Nov 2, 2011 at 2:43 AM, Michael Wild <span dir="ltr">&lt;<a href="mailto:themiwi@gmail.com">themiwi@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 class="im">On 11/01/2011 09:49 PM, Robert Dailey wrote:<br>
&gt; Well if you need any help coding the feature let me know. I&#39;m already<br>
&gt; liking the idea of adding features I want myself into CMake :)<br>
&gt;<br>
&gt; Thanks!<br>
&gt;<br>
&gt; ---------<br>
&gt; Robert Dailey<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Nov 1, 2011 at 3:47 PM, David Cole &lt;<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a><br>
</div><div class="im">&gt; &lt;mailto:<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     On Tue, Nov 1, 2011 at 4:33 PM, Robert Dailey &lt;<a href="mailto:rcdailey@gmail.com">rcdailey@gmail.com</a><br>
</div><div class="im">&gt;     &lt;mailto:<a href="mailto:rcdailey@gmail.com">rcdailey@gmail.com</a>&gt;&gt; wrote:<br>
&gt;     &gt; On Tue, Nov 1, 2011 at 3:32 PM, David Cole &lt;<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a><br>
</div><div class="im">&gt;     &lt;mailto:<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>&gt;&gt; wrote:<br>
&gt;     &gt;&gt;<br>
&gt;     &gt;&gt; Not yet<br>
&gt;     &gt;<br>
&gt;     &gt; Meaning there are plans in the works to add such functionality in<br>
&gt;     the near<br>
&gt;     &gt; future?<br>
&gt;     &gt; For now I guess I could actually hard code VS environment<br>
&gt;     variables in my<br>
&gt;     &gt; include directory strings, such as $(Configuration).<br>
&gt;<br>
&gt;     There is a feature planned to add per-target include directories (as a<br>
&gt;     target property). As part of that work, we will probably naturally<br>
&gt;     also add per-configuration values of that new target property. It is<br>
&gt;     not yet added as a feature request in the bug tracker, but there are<br>
&gt;     related ones that I may &quot;borrow&quot; for the purpose. Stay tuned for more<br>
&gt;     info, but it is not coming in the next week or two. Hopefully, in time<br>
&gt;     for 2.8.7, but it depends on timing at this point.... so no promises.<br>
&gt;<br>
&gt;     For now, your $(Configuration) idea is probably your best bet. (And<br>
&gt;     would continue to work even after we implement this feature...)<br>
&gt;<br>
&gt;<br>
&gt;     HTH,<br>
&gt;     David<br>
<br>
</div>Alternatively, if you want to keep it cross-platform and generator<br>
independent, you could use a proxy header which #include&#39;s the correct<br>
header using relative or absolute paths using #ifdef&#39;s. Probably that<br>
proxy header would need to be generated by configure_file(). You then<br>
would pass the configuration name by setting the<br>
COMPILE_DEFINITIONS_&lt;CONFIG&gt; property on the directory, target or source<br>
file affected.<br>
<br>
<br>
Say you have the following layout:<br>
<br>
project/<br>
|-- CMakeLists.txt<br>
|-- src/<br>
|   |-- frobnicate.c<br>
`-- include/<br>
    |-- Debug/<br>
    |   |-- foo.h<br>
    |   `-- bar.h<br>
    `-- Optimized/<br>
        |-- foo.h<br>
        `-- bar.h<br>
<br>
Now, you want to include the configuration dependent foo.h and bar.h in<br>
frobnicate.c without having to change frobnicate.c itself and might look<br>
like this:<br>
<br>
frobnicate.c<br>
&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br>
#include &quot;foo.h&quot;<br>
#include &quot;bar.h&quot;<br>
<br>
int main(int argc, char** argv)<br>
{<br>
  foo();<br>
  bar();<br>
  return 0;<br>
}<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
<br>
To get around the issue of needing a configuration-dependent include<br>
path, you could do the following in your CMakeLists.txt file:<br>
<br>
CMakeLists.txt:<br>
&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br>
cmake_minimum_required(VERSION 2.6)<br>
project(frobnicate C)<br>
<br>
# loads of stuff ....<br>
<br>
# generate wrapper headers for foo.h and bar.h<br>
foreach(hdr foo.h bar.h)<br>
  # find a good include guard name<br>
  string(TOUPPER &quot;${hdr}&quot; incguard)<br>
  string(REGEX REPLACE &quot;[^a-zA-Z0-9_]&quot; &quot;_&quot; incguard<br>
    &quot;PROXY_HDR_${incguard}&quot;)<br>
  # write the proxy header<br>
  file(WRITE &quot;${PROJECT_BINARY_DIR}/include/${hdr}&quot;<br>
&quot;<br>
/* AUTOMATICALLY GENERATED BY CMAKE -- DO NOT EDIT! */<br>
#pragma once<br>
#ifndef ${incguard}<br>
#define ${incguard}<br>
<br>
/* if building debug configuration, include Debug/${hdr},<br>
   otherwise Optimized/${hdr} */<br>
#if defined(CONFIG_DEBUG)<br>
#  include \&quot;Debug/${hdr}\&quot;<br>
#else<br>
#  include \&quot;Optimized/${hdr}\&quot;<br>
#endif<br>
<br>
#endif<br>
&quot;)<br>
endforeach()<br>
<br>
# set up the definitions for the switch yard<br>
set_directory_properties(PROPERTIES<br>
  COMPILE_DEFINITIONS_DEBUG CONFIG_DEBUG<br>
  COMPILE_DEFINITIONS_RELEASE CONFIG_RELEASE<br>
  COMPILE_DEFINITIONS_RELWITHDEBINFO CONFIG_RELWITHDEBINFO<br>
  COMPILE_DEFINITIONS_MINSIZEREL CONFIG_MINSIZE_REL)<br>
<br>
# set up the include directories so our proxy headers and the actual<br>
# headers can be found by the preprocessor<br>
include_directories(<br>
  ${PROJECT_BINARY_DIR}/include<br>
  ${PROJECT_SOURCE_DIR}/include)<br>
<br>
add_executable(frobnicate frobnicate.c)<br>
<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
<br>
<br>
HTH<br>
<span class="HOEnZb"><font color="#888888"><br>
Michael<br>
</font></span><div class="HOEnZb"><div class="h5">--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div>