Using C++0x in Xcode 4.2 project via CMake

前端 未结 2 2028
猫巷女王i
猫巷女王i 2021-02-04 04:04

I\'m using CMake to generate a project file for Xcode 4.2 on OSX Lion, and I\'m using some of the C++0x features in LLVM like nullptr and auto. In order to use these, Xcode requ

2条回答
  •  情书的邮戳
    2021-02-04 04:47

    after digging into this for a little, these are the commands to set the appropriate xcode settings:

    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_CXX_FLAGS} -std=c++0x -stdlib=libc++ -g -Wall")
    

    I think setting the c++ flags is redundant, so it might also work without the last line.

    hope that helps!

提交回复
热议问题