title: Construct path for #include directive with macro
body: <p>I would like to have include file paths dynamically created by a macro for a target-configuration-dependent part of my program.</p>
  
  <p>for example, I would like to construct a macro that would be invoked like this:</p>
  
  <pre><code>#include TARGET_PATH_OF(header.h)
  </code></pre>
  
  <p>Which will expand to a something like this: </p>
  
  <pre><code>#include "corefoundation/header.h"
  </code></pre>
  
  <p>when the source is configured (in this case) for OSX</p>
  
  <p>So far all attempts have failed. I'm hoping someone out there has done this before?</p>
  
  <p>example of what does not work:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/preprocessor.hpp&gt;
  
  #define Dir directory/
  #define File filename.h
  
  #define MakePath(f) BOOST_PP_STRINGIZE(BOOST_PP_CAT(Dir,f))
  #define MyPath MakePath(File)
  
  using namespace std;
  
  int main() {
      // this is a test - yes I know I could just concatenate strings here
      // but that is not the case for #include
      cout &lt;&lt; MyPath &lt;&lt; endl;
  }
  </code></pre>
  
  <p>errors:</p>
  
  <pre><code>./enableif.cpp:31:13: error: pasting formed '/filename', an invalid preprocessing token
      cout &lt;&lt; MyPath &lt;&lt; endl;
              ^
  ./enableif.cpp:26:16: note: expanded from macro 'MyPath'
  #define MyPath MakePath(File)
                 ^
  ./enableif.cpp:25:40: note: expanded from macro 'MakePath'
  #define MakePath(f) BOOST_PP_STRINGIZE(BOOST_PP_CAT(Dir,f))
                                         ^
  /usr/local/include/boost/preprocessor/cat.hpp:22:32: note: expanded from macro 'BOOST_PP_CAT'
  #    define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b)
                                 ^
  /usr/local/include/boost/preprocessor/cat.hpp:29:36: note: expanded from macro 'BOOST_PP_CAT_I'
  #    define BOOST_PP_CAT_I(a, b) a ## b
                                     ^
  1 error generated.
  </code></pre>