CMake,Xcode和Unix Makefile [英] CMake, Xcode and Unix Makefile

查看:174
本文介绍了CMake,Xcode和Unix Makefile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用经典的Unix Makefile生成器,直到我发现一个网页解释CMake可以使用cmake -G Xcode生成一个漂亮的xcode项目文件,所以我在我的源目录中运行该命令,我得到一个不错的xcode项目。这是伟大的,但我面临一些缺点,并想知道是否有解决这些:

I was using classic Unix Makefile generator until I found a webpage explaining CMake could produce a nice xcode project file using "cmake -G Xcode" so I ran that command in my source directory and I get a nice xcode project. This is great but I'm facing some drawback and was wondering if there are solutions to these :


  • 现在我不能使用unix makefile(我使用运行cmake ../myproj在build dir然后make命令)这不工作了(我想项目dir中的临时文件负责)

  • now I can't build out of tree using unix makefiles (I use to run cmake ../myproj in a build dir and then make command) this doesn't work anymore (I suppose temp files in the project dir are responsible)

我的一些头由cmake生成(myproj.h.in成为myproj.h并在一些测试中包括例如),但我不能在xcode中找到这些文件项目我获得。

some of my headers are generated by cmake (myproj.h.in became myproj.h and is include in some tests for example) but I can't find those files in the xcode project I get.

提前感谢任何好的建议如何可以结合xcode项目和unix makefile

Thanks in advance for any good advice on how I can combine xcode project and unix makefile to be able to use both.

推荐答案

我自己找到了答案(我的意思是询问好人):

I found the answer by myself (I mean asking the good person) :

为每种类型的构建文件使用2个单独的构建目录。这将确保每个构建目录具有正确的构建文件和生成的文件供其使用。

Use 2 separate build directories for each type of build files. This will ensure each build directory has the correct build files and generated files for its use.

在add_executable()命令中,除了源文件还包括头文件和生成的标题以便显示在Xcode中。

In the add_executable() command, in addition to the source files also include the headers and generated headers for those to show up in Xcode.

这篇关于CMake,Xcode和Unix Makefile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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