This fix works on my Xcode 5.0.2 machine. Committed a fix.

I'm not up to speed on cmake enough to be able to fully understand the fix. Will test on OSX, ARM and PPC but will rely on synfinatic to fix compatibility issues.