Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake Xcode generator creates a project that cannot build

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?

like image 702
aaragon Avatar asked Feb 10 '11 18:02

aaragon


1 Answers

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.

like image 132
Randall Cook Avatar answered Oct 22 '22 16:10

Randall Cook