title: Use environment variable as compile time constant in C++
body: <p>As part of a build process, I need to take an environment variable defined by a batch script and use it as a constant within the code at compile time.</p>
  
  <p>For example, say I have defined an environment variable named <code>BUILD_VERSION</code> and set it to <code>1.0.0</code>, when compiled I want <code>1.0.0</code> to be baked into my code. EG:</p>
  
  <p>Batch file:</p>
  
  <pre><code>set BUILD_VERSION = 1.0.0
  ; call vs compiler
  </code></pre>
  
  <p>C++ File:</p>
  
  <pre><code>const std::string build_version = BUILD_VERSION // Which will result in "1.0.0".
  </code></pre>
  
  <p>How would I go about doing this?</p>