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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With