为什么在使用cmake生成xcode项目时CMAKE_OSX_DEPLOYMENT_TARGET不起作用? [英] Why the CMAKE_OSX_DEPLOYMENT_TARGET not work when using cmake generate xcode project?
问题描述
我开发了一个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
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屋!