Search code examples
xcode4autocompletemakefilesyntax-highlighting

Xcode 4 external build system code completion


When i use Xcode 4 with an external build system like make, i lose code completion and syntax highlighting. Is there any way to fix this?


Solution

  • A quite ugly solution I have used is to add an additional dummy iOS or Mac OS X Application target that I only use to get code completion and documentation.

    Do something like this:

    1. Add a "Cocoa Application" target and name it <project name>-doc.
    2. Add files you like to edit to a new group or use the newly created target group.
    3. Make sure the files you like to edit is marked as members in the <project name>-doc target using the "Target Membership" section in the right side utilities view.

    Now edit along and build using your external build system target.

    If this is a iOS project you can even take it one step further and add an additional "Empty Application" <project name>-run target used to "fool" Xcode to run your externally built application in the simulator or even on a device, assuming your external build system know how to sign and build universal or just normal binaries with correct architecture(s).

    1. Add a "Empty Application" iOS target and name it <project name>-run.
    2. Edit the scheme for <project name>-run and add your external build system target as a target before the <project name>-run target.
    3. Change the "Run ..." section for <project name>-run scheme by pointing the executable path to the application bundle built by your external build system.

    Now edit along and build and run using the <project name>-run target and it will trigger your external target and then run in the simulator or debug on the device. I have done this in combination with a <project name>-doc target and it works fine, just make sure to mark files you edit to only be a member of the <project name>-doc target or else Xcode will try to build things for you.