summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2019-01-16 19:42:10 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-18 12:52:17 (GMT)
commit0ffe8f8844bb74e785feec84e4871ec139185625 (patch)
treec9c465039cae8273f6b04b2c62e2f8de2babd09d /Source/cmNinjaTargetGenerator.cxx
parentc59eae7ebc5423c2b06befd762f8639b0f23b7a0 (diff)
downloadCMake-0ffe8f8844bb74e785feec84e4871ec139185625.zip
CMake-0ffe8f8844bb74e785feec84e4871ec139185625.tar.gz
CMake-0ffe8f8844bb74e785feec84e4871ec139185625.tar.bz2
Ninja: support `SWIFT_MODULE_NAME` property
Add a new `SWIFT_MODULE_NAME` property that defaults to the target name. This is needed as otherwise, the first source file determines the module name. Issue: #18800
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 5013be5..c959a04 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -433,6 +433,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
vars.ObjectFileDir = "$OBJECT_FILE_DIR";
if (lang == "Swift") {
vars.SwiftAuxiliarySources = "$SWIFT_AUXILIARY_SOURCES";
+ vars.SwiftModuleName = "$SWIFT_MODULE_NAME";
}
// For some cases we do an explicit preprocessor invocation.
@@ -904,9 +905,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
vars["DEFINES"] = this->ComputeDefines(source, language);
vars["INCLUDES"] = this->ComputeIncludes(source, language);
- // The swift compiler needs all the sources besides the one being compiled in
- // order to do the type checking. List all these "auxiliary" sources.
if (language == "Swift") {
+ // The swift compiler needs all the sources besides the one being compiled
+ // in order to do the type checking. List all these "auxiliary" sources.
std::string aux_sources;
cmGeneratorTarget::KindedSources const& sources =
this->GeneratorTarget->GetKindedSources(this->GetConfigName());
@@ -917,6 +918,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
aux_sources += " " + this->GetSourceFilePath(src.Source.Value);
}
vars["SWIFT_AUXILIARY_SOURCES"] = aux_sources;
+
+ vars["SWIFT_MODULE_NAME"] = this->GeneratorTarget->GetName();
}
if (!this->NeedDepTypeMSVC(language)) {