diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c493778..bc97e88 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1987,6 +1987,18 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement( return !isMultiThread && compileMode == cmSwiftCompileMode::Wholemodule; }(); + // Without `-emit-library` or `-emit-executable`, targets with a single + // source file parse as a Swift script instead of like normal source. For + // non-executable targets, append this to ensure that they are parsed like a + // normal source. + if (target.GetType() != cmStateEnums::EXECUTABLE) { + this->LocalGenerator->AppendFlags(vars["FLAGS"], "-parse-as-library"); + } + + if (target.GetType() == cmStateEnums::STATIC_LIBRARY) { + this->LocalGenerator->AppendFlags(vars["FLAGS"], "-static"); + } + // Swift modules only make sense to emit from things that can be imported. // Executables that don't export symbols can't be imported, so don't try to // emit a swiftmodule for them. It will break. @@ -2011,14 +2023,6 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement( vars["FLAGS"], cmStrCat(libraryLinkNameFlag, ' ', libraryLinkName)); } - // Without `-emit-library` or `-emit-executable`, targets with a single - // source file parse as a Swift script instead of like normal source. For - // non-executable targets, append this to ensure that they are parsed like a - // normal source. - if (target.GetType() != cmStateEnums::EXECUTABLE) { - this->LocalGenerator->AppendFlags(vars["FLAGS"], "-parse-as-library"); - } - this->LocalGenerator->AppendFlags(vars["FLAGS"], this->GetFlags(language, config)); vars["DEFINES"] = this->GetDefines(language, config); |