在Xcode 4.2项目中通过CMake使用C ++ 0x [英] Using C++0x in Xcode 4.2 project via CMake

查看:186
本文介绍了在Xcode 4.2项目中通过CMake使用C ++ 0x的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CMake的生成在OSX狮子的Xcode 4.2项目文件,我使用一些在LLVM的C ++ 0x的功能,如nullptr和经销商。为了使用这些时,Xcode要求2项目设置进行设置:

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 requires that 2 project settings be set:

C ++语言方言设置的C ++ 0x [-std =的C ++ 0x]

C++ Language Dialect set to C++0x [-std=C++0x]

C ++标准库设置为++(LLVM C ++标准库,C ++ 0X支持)在libc

C++ Standard Library set to libc++ (LLVM C++ standard library with C++'0X support)

目前我每次生成一个Xcode项目,我必须进去并手动调整这些设置。

Currently every time I generate an Xcode project, I have to go in and manually adjust these settings.

有没有CMake的指定这些设置吗?

Is there a way to specify these settings in CMake?

感谢

推荐答案

挖掘到这了一小后,这些设置适当的Xcode设置的命令:

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")

我觉得设置C ++的标志是多余的,所以它也可能没有最后一行的工作。

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

希望帮助!

这篇关于在Xcode 4.2项目中通过CMake使用C ++ 0x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆