claf
claf

Reputation: 9263

CMake, Xcode and Unix Makefile

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 :

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

Upvotes: 26

Views: 26410

Answers (2)

Martin
Martin

Reputation: 441

You can use xcodebuild to still have a proper Xcode project and build it from the command line/shell script/Makefile, e.g.

xcodebuild -project MyProject.xcodeproj -target MyTarget -configuration Release

Upvotes: 3

claf
claf

Reputation: 9263

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

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.

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.

Upvotes: 14

Related Questions