title: What CMake variable is used to set C++ Standard Library in XCode?
body: <p>I have a pure C++11 DLL (No dependencies of any kind) I have been able to compile on Linux and Windows for some time now using CMake to generate the project files and make/MSVC to compile in each respective native system.</p>
  
  <p>I want to compile on OSX now and I have been having a lot of problems getting CMake to set the correct project settings in XCode to compile the DLL.</p>
  
  <p>Software versions:</p>
  
  <pre><code>XCode v5.0
  CMake v2.8.12
  </code></pre>
  
  <p>The relevant CMake script code:</p>
  
  <pre><code># Set output directory if Apple OSX:
  IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
      message("CMAKE HAS DETECTED A OSX SYSTEM - BUILDING FOR XCODE!")
  
      set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0")
      set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x")
      set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
      set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++0x -stdlib=libc++")
  
      IF(CMAKE_BUILD_TYPE MATCHES Release)
          SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../bin/OSX/Release)
      ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
      IF(CMAKE_BUILD_TYPE MATCHES Debug)
          SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../bin/OSX/Debug)
      ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
  ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  </code></pre>
  
  <p>However the settings do not correctly come through into the XCode project file:</p>
  
  <p><img src="https://i.stack.imgur.com/nCK2n.png" alt="enter image description here"></p>
  
  <p>You can see that the CMake commands make their way into the 'Other C++ Flags' area. But XCode will still fail to compile. However, if I change the 'C++ Standard Library' variable to 'libc++' it will compile fine.</p>
  
  <p>Note: I could post the compile error logs however I think that the above correctly identifies the root cause - I just need to know what CMake command actually sets the correct XCode property above.</p>