title: How do I use conditional compilation with `cfg` and Cargo?
body: <p>I want to conditionally compile my source code using <code>cfg</code> with Cargo,
  after Googling for a while,
  it seems that the solution is to use <code>cargo --features</code>.</p>
  
  <p><a href="http://doc.crates.io/manifest.html" rel="noreferrer">http://doc.crates.io/manifest.html</a></p>
  
  <p>I tried adding a few</p>
  
  <pre><code>#[cfg(feature = "foo")]
  </code></pre>
  
  <p>in the source code and</p>
  
  <pre><code>cargo build --features foo
  </code></pre>
  
  <p>, but it says</p>
  
  <pre><code>Package `xxx v0.0.1 (file:///C:/yyy/xxx)` does not have these features: `foo`
  </code></pre>
  
  <p>How can I let cargo identify the features? Do I have to add something in <code>Cargo.toml</code>?</p>
  
  <p>Here's the version of <code>rustc</code> and <code>cargo</code> I am using:</p>
  
  <pre><code>C:\&gt;rustc --version
  rustc 0.13.0-nightly (42deaa5e4 2014-12-16 17:51:23 +0000)
  
  C:\&gt;cargo --version
  cargo 0.0.1-pre-nightly (5af754d 2014-12-18 01:50:48 +0000)
  </code></pre>