title: How can I override a constant via a compiler option?
body: <p>Is it possible to define a constant in source code that can be overridden by a compiler flag? That is, something like setting a <code>#define</code> value in the C preprocessor with the <code>-D key=val</code> option to the compiler.</p>
  
  <p>I have read about conditional compilation via the <code>#[cfg(...)]</code> attribute, but that only seems to support booleans. I want to allow the user to set the value of a constant during compilation.</p>
  
  <p>Something like this:</p>
  
  <pre><code>#[from_cfg("max_dimensions")]
  const MAX_DIMENSIONS: usize = 100_000;
  </code></pre>