Error with paths containing spaces in generated Ninja for C++/Swift interop

It looks like there is a bug in the CMake/Ninja generated swiftc invocation if a path contains spaces. The error message looks like

[build] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -j 12 -num-threads 12 -c  -module-name SwiftInteroppenheimer -Onone -g -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -incremental -cxx-interoperability-mode=default -parse-as-library -output-file-map "\"src src/CMakeFiles/Interop.dir/Debug/output-file-map.json\"" -I "/Users/winfried.auner/Developer/swift_cpp_interop_cmake/build/src src/include" '/Users/winfried.auner/Developer/swift_cpp_interop_cmake/src src/func.swift'
[build] error: unable to load output file map '"src src/CMakeFiles/Interop.dir/Debug/output-file-map.json"': FileSystemError(kind: TSCBasic.FileSystemError.Kind.noEntry, path: Optional(<AbsolutePath:"/Users/winfried.auner/Developer/swift_cpp_interop_cmake/build/"src src/CMakeFiles/Interop.dir/Debug/output-file-map.json"">))

and I was able to reproduce this in a minimal example, see here .

If I change the src/ path to src src/ the argument to -output-file-map (the path to output-file-map.json) gets quotes incorrectly and the build fails. The problem is:

-output-file-map "\"src src/CMakeFiles/Interop.dir/Debug/output-file-map.json\""

Is this an error in Apple’s CMake example for the interop (which my example is based on) or somewhere else in CMake?
I’ve posted this originally in the swift forums, but didn’t get any reply.

This looks appropriate for a bug report, so could you please submit it in CMake’s issue tracker: http://gitlab.kitware.com/cmake/cmake/-/issues/new

Once it’s there, we can tag the relevant people who maintain that part of the code.

Thanks @craig.scott I’ll do that.