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

**URL:** https://discourse.cmake.org/t/error-with-paths-containing-spaces-in-generated-ninja-for-c-swift-interop/12830
**Category:** Usage
**Tags:** os:macos
**Created:** [October 24, 2024, 8:54am UTC](https://discourse.cmake.org/t/error-with-paths-containing-spaces-in-generated-ninja-for-c-swift-interop/12830 "2024-10-24T08:54:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wAuner](https://discourse.cmake.org/user_avatar/discourse.cmake.org/wauner/32/5041_2.png) [@wAuner](https://discourse.cmake.org/u/wAuner)
#### Post date: [October 24, 2024, 8:54am UTC](https://discourse.cmake.org/t/error-with-paths-containing-spaces-in-generated-ninja-for-c-swift-interop/12830/1 "2024-10-24T08:54:59Z")

</div>

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

```auto
[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](https://github.com/wAuner/swift_cpp_interop_cmake/tree/paths-with-spaces).

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:

```auto
-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](https://forums.swift.org/t/error-with-paths-containing-spaces-in-swiftc-argument-for-output-file-map/75368), but didn’t get any reply.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [October 25, 2024, 4:45am UTC](https://discourse.cmake.org/t/error-with-paths-containing-spaces-in-generated-ninja-for-c-swift-interop/12830/2 "2024-10-25T04:45:45Z")

</div>

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](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.

---

<div class="post-metadata">

### Author: ![wAuner](https://discourse.cmake.org/user_avatar/discourse.cmake.org/wauner/32/5041_2.png) [@wAuner](https://discourse.cmake.org/u/wAuner)
#### Post date: [October 25, 2024, 6:26am UTC](https://discourse.cmake.org/t/error-with-paths-containing-spaces-in-generated-ninja-for-c-swift-interop/12830/3 "2024-10-25T06:26:58Z")

</div>

Thanks @craig.scott I’ll do that.
