如何使用qmake指定目标Mac OS X版本 [英] How to specify target mac os x version using qmake

查看:602
本文介绍了如何使用qmake指定目标Mac OS X版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Qt Creator/qmake在Mac OS X上编译c ++ 11代码,但出现以下错误:

I am trying to compile c++11 code on the Mac OS X using Qt Creator/qmake and I am getting the following error:

clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)

当我检查编译命令行时,我注意到它包含-mmacosx-version-min = 10.6标志.我尝试如下更新我的.pro文件,但是似乎没有考虑到这一点:

When I checked the compile command line, I noticed that it contains the -mmacosx-version-min=10.6 flag. I tried to update my .pro file as follows, but it seems that this is not taken into account:

QMAKE_CXXFLAGS += -std=c++11 -stdlib=libc++

macx {
    -mmacosx-version-min=10.7
}

任何建议都会有所帮助.谢谢!

Any suggestions would be helpful. Thanks!

推荐答案

您实际上可以添加该部署目标行QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 到您的QMake项目文件.您不必重新安装Qt.

You can actually add that deployment target line QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 to your QMake project file. You don't have to reinstall Qt.

但是要记住一件事:如果要构建应用程序捆绑包中包含的任何其他库,请确保也对它们进行了编译以实现向后兼容性!如果它对任何库都有用的话,还有一个等效的CMake命令,CMAKE_OSX_DEPLOYMENT TARGET.

One thing to keep in mind, though: if you build any other libraries that you include in your application bundle, make sure they're also compiled for backwards compatibility! In case it helps with any libraries, there's an equivalent CMake command as well, CMAKE_OSX_DEPLOYMENT TARGET.

这篇关于如何使用qmake指定目标Mac OS X版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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