为什么在使用cmake生成xcode项目时CMAKE_OSX_DEPLOYMENT_TARGET不起作用? [英] Why the CMAKE_OSX_DEPLOYMENT_TARGET not work when using cmake generate xcode project?

查看:163
本文介绍了为什么在使用cmake生成xcode项目时CMAKE_OSX_DEPLOYMENT_TARGET不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个CMake项目来生成一个Xcode项目,我想在其中将部署目标设置为macOS 10.12,所以我添加了

I developed a CMake project to generate an Xcode project, where I want to set the deployment target to macOS 10.12, so I add

set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version")

> CMake之后,我的CMakeLists.txt中的

CMake似乎忽略了CMAKE_OSX_DEPLOYMENT_TARGET.重建CMake项目时,生成的Xcode项目中的部署目标未设置为macos 10.12,而是默认设置为10.14,这是我没想到的.

in my CMakeLists.txt, following the CMake seems to ignore CMAKE_OSX_DEPLOYMENT_TARGET. When rebuilding the CMake project, the deployment target in the generated Xcode project is not set to macos 10.12, but to the default 10.14, which I did not expect.

如何解决它,以便Xcode项目部署目标使用CMake设置?

How can I fix it, so that the Xcode project deployment target uses the CMake setting?

推荐答案

我已经尝试了多次,并找到了解决方案:只需在set()语法的末尾添加'FORCE'

I had tried multiple times and find the solution: just add the 'FORCE' end the set() syntax

set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version" FORCE)

希望它可以帮助某人!

这篇关于为什么在使用cmake生成xcode项目时CMAKE_OSX_DEPLOYMENT_TARGET不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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