CMake, Xcode and Unix Makefile CMake, Xcode and Unix Makefile xcode xcode

CMake, Xcode and Unix Makefile


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.


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