title: CMAKE, Clang and C++v11 on OS X 10.8
body: <p>OS X 1.8</p>
  
  <p>CMAKE 2.8.9</p>
  
  <p>Clang <code>$ clang -v
  Apple clang version 4.0 (tags/Apple/clang-421.10.60) (based on LLVM 3.1svn)
  Target: x86_64-apple-darwin12.0.0
  Thread model: posix</code></p>
  
  <p>CMAKELists.txt:</p>
  
  <pre><code>cmake_minimum_required (VERSION 2.8.9)
  project (Test)
  add_executable(Test main.cpp)
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>//Create a C++11 thread from the main program
  #include &lt;iostream&gt;
  #include &lt;thread&gt;
  
  //This function will be called from a thread
  void call_from_thread() {
      std::cout &lt;&lt; "Hello, World!" &lt;&lt; std::endl;
  }
  
  int main() {
      //Launch a thread
      std::thread t1(call_from_thread);
  
      //Join the thread with the main thread
      t1.join();
  
      return 0;
  }
  </code></pre>
  
  <p>My error:</p>
  
  <pre><code>$ make
  Scanning dependencies of target Test
  [100%] Building CXX object CMakeFiles/Test.dir/main.cpp.o
  test/main.cpp:4:10: fatal error: 'thread' file not found
  #include &lt;thread&gt;
       ^
  1 error generated.
  make[2]: *** [CMakeFiles/Test.dir/main.cpp.o] Error 1
  make[1]: *** [CMakeFiles/Test.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>
  
  <p>So does the version of Clang not support C++v11 features? This same program does compile under gcc-4.7.1 on OSX 10.8</p>
  
  <p>This reference says it should work <code>http://www.cpprocks.com/a-comparison-of-c11-language-support-in-vs2012-g-4-7-and-clang-3-1/</code></p>
  
  <p>What am I doing wrong?</p>