title: Export all functions in imported header files
body: <p>I am building a dll file using cmake and c++ on windows. My project is composed of several header files, and one complete header file to be included in a different c++ project. The larger header file looks something like the following:</p>
  
  <pre><code>#include "header1.h"
  #include "header2.h"
  #include "header3.h"
  ...
  </code></pre>
  
  <p>I read that I have to use <code>__declspec(dllimport)</code> and <code>__declspec(dllexport)</code>, so I have used some ifdef statements like this:</p>
  
  <pre><code>#ifdef _WIN32
  #    ifdef EXPORT
  #        define API __declspec(dllexport)
  #    else
  #        define API __declspec(dllimport)
  #    endif
  #elif
  #    define API
  #endif
  </code></pre>
  
  <p>My questions is: do I have to put this in every header file, or can I somehow do it for the header file as a whole? For example, like this:</p>
  
  <pre><code>#include API "header1.h"
  #include API "header2.h"
  #include API "header3.h"
  ...
  </code></pre>
  
  <p>(does not work, but is there something similar to this that does?)</p>