Unable to integrate Xcode with Ninja

The issue I opened for building with Xcode was closed in favor of integration with Ninja. I tried those instructions, but I'm still unable to get Xcode working. Here's what I'm doing:

  • Build with ninja
utils/build-script --skip-build-benchmarks \                                                     
-j10 --skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
--sccache --release-debuginfo --swift-disable-dead-stripping --bootstrapping=off
  • Add --xcode to that command.
  • Receive this error:
CMake Error at cmake/modules/CheckCompilerVersion.cmake:57 (if):
  if given arguments:

    "(" "STREQUAL" "MSVC" ")" "AND" "(" "19.24" "VERSION_LESS_EQUAL" ")" "AND" "(" "VERSION_LESS" "19.25" ")"

  Unknown arguments specified
Call Stack (most recent call first):
  cmake/config-ix.cmake:14 (include)
  CMakeLists.txt:744 (include)

CMakeError.log
CMakeOutput.log

Here is my setup:
M1 Pro MacBook Pro
macOS 13.0 (22A380)
Xcode Version 14.1 (14B47b)
xcode-select -p = /Applications/Xcode.app/Contents/Developer
swift-project hashes

Woah, I think I found the issue. My CMake was out of date. I was running 3.21.x, and the docs state you need 3.19.6 or higher. I upgraded to the latest (3.24.3) and now the build succeeded. The "unknown arguments specified" made me suspect the version. I'll open a Github issue to update the required version.

As an aside, utils/build-script --xcode --release --swift-darwin-supported-archs "$(uname -m) (+ -j10 in your case) is optimal for generating Xcode projects. The other flags are ignored anyway.

1 Like