cmake从现有源生成Xcode项目 [英] cmake generate Xcode project from existing sources

查看:659
本文介绍了cmake从现有源生成Xcode项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我有,当我开始一代:

This is what i have, when i starting generation:

iMac:IXCSoftswitch alex$ /usr/bin/cmake -G Xcode .
-- CMAKE_SOURCE_DIR = /Users/alex/Desktop/ixc-v/IXCSoftswitch,   CMAKE_BINARY_DIR = /Users/alex/Desktop/ixc-v/IXCSoftswitch
CMake Error at CMakeLists.txt:25 (MESSAGE):
  Binary and source directory cannot be the same


-- Configuring incomplete, errors occurred!

如何解决?

推荐答案

CMake用于产生 out-of-source

CMake is used to produce out-of-source builds.

这里是不要混合在编译期间创建的文件与原始源文件。在实践中,通常从一个新的,空的构建目录运行CMake,并将源目录的路径作为参数。

The idea here is that you don't mix the files created during compilation with the original source files. In practice, you usually run CMake from a new, empty build directory and give the path to the source directory as an argument.

cd IXCSoftswitch
mkdir build
cd build
cmake -G Xcode ..

CMake生成的所有文件(可以是 lot )现在将进入 build 子目录,清除构建工件。

All of the files generated by CMake (which could be a lot) will now go into the build subdirectory, while your source directory stays clean of build artifacts.

源外部构建的概念可能看起来很奇怪,但它实际上是一个非常方便的工作方式,一旦你习惯了

The concept of out-of-source builds may seem strange at first, but it is actually a very convenient way of working once you get used to it.

这篇关于cmake从现有源生成Xcode项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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