Skip to content

Ninja: Fix mixed Swift/CXX library target generation

Evan Wilde requested to merge etcwilde/cmake:ewilde/mixed-swift-libraries into master

With how things were before, mixed Swift/C++ libraries would result in a broken ninja file. cpp.cpp.o was emitted by the compiler, but was also being included in the linkBuild.Outputs list, so it was being emitted by multiple targets.

The fix checks that the source language is Swift before adding it to the list of additional outputs. If it is Swift, this isn't a problem. If it isn't Swift, we don't include it in the list of outputs.

On the other side, the C++ file was also being passed as a source file, which the Swift compiler can't compile. So we add the C++ object file as an explicit dependency and the object file is then added to the list of Swift sources.

Topic-rename: swift-mix-cxx

Edited by Brad King

Merge request reports