CMake Xcode generator creates a project that cannot build

泪湿孤枕 提交于 2020-01-02 03:50:48

问题


I have a C++ project that uses the CMake build system. I use a MacBook Pro for development, so when I use the terminal everything works like a charm, and I can build my project.

However, today I found out that I could use Xcode after creating the respective project using the CMake generator:

$> cmake -G Xcode .

It works the project and it looks fine, except for the fact that I can't build anything. It doesn't recognize symbols included from included files. Why is this? It seems as if the CMake environmental variables are not passed to Xcode.

How can I fix this?


回答1:


Omit the dot (.) in your command invocation, leaving just cmake -G Xcode. When I first started using CMake, I also was generating Xcode projects that would not build. I was using CMake's interactive wizard UI, which led to a world of hurt. As often happens, using the simplest command is often the way to go. Once I stopped using the wizard and just using the defaults, I got an Xcode project that builds reliably.



来源:https://stackoverflow.com/questions/4961123/cmake-xcode-generator-creates-a-project-that-cannot-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!