简体   繁体   English

如何使用cmake脚本从命令行中选择用于编译C ++代码的xcode版本

[英]how to choose the version of xcode for compilation C++ codes from command line with cmake scripts

In the MAC there are two xcode APP: one is xcode4 and the other is xcode5. 在MAC中,有两个xcode APP:一个是xcode4,另一个是xcode5。 When I compile the C++ project with cmake, it will invoke xcode 5 directly rather than xcode 4, and I was wondering whether there is a way to call xcode 4 directly when I invoke cmake scripts from command line. 当我使用cmake编译C ++项目时,它将直接调用xcode 5而不是xcode 4,并且我想知道当我从命令行调用cmake脚本时是否有一种直接调用xcode 4的方法。 Thanks. 谢谢。

EDIT: 编辑:

Final solution is 最终的解决方案是

sudo xcode-select --switch Path/to/xcode4

After that setting, it will work. 完成该设置后,它将起作用。 I try to set the enviroment varialbe DEVELOPER_DIR, although I can clearly see that the directed path is xcode4, when invoking cmake scripts it still call xcode5. 我尝试设置环境变量DEVELOPER_DIR,尽管我可以清楚地看到定向路径是xcode4,但是在调用cmake脚本时,它仍称为xcode5。

Currently used Xcode version can be received by executing: 可以通过执行以下命令来接收当前使用的Xcode版本:

xcode-select --print-path

You can change it by modifying environment variable DEVELOPER_DIR . 您可以通过修改环境变量DEVELOPER_DIR进行更改。 From documentation : 文档

   DEVELOPER_DIR
      Overrides the active developer directory. When DEVELOPER_DIR is set,
      its  value  will  be  used instead of the system-wide
      active developer directory.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM