summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2019-05-20 15:40:07 (GMT)
committerSaleem Abdulrasool <compnerd@compnerd.org>2019-05-20 16:28:35 (GMT)
commit62381effba418cdccff0b18f234e3a307446d635 (patch)
tree39c2272c796b38ade26036009701000cfd225eb9 /Source/cmNinjaNormalTargetGenerator.cxx
parente025495b8500f9aaf6745571ffdb48a6218e7929 (diff)
downloadCMake-62381effba418cdccff0b18f234e3a307446d635.zip
CMake-62381effba418cdccff0b18f234e3a307446d635.tar.gz
CMake-62381effba418cdccff0b18f234e3a307446d635.tar.bz2
Ninja,Swift: reuse `SWIFT_MODULE_NAME` for `SWIFT_MODULE`
Rather than compute the value of `SWIFT_MODULE`, use the computed value of `SWIFT_MODULE_NAME`. This is helpful strictly for Windows where you have multiple configuration variants with differing ABIs that need must co-exist. In particular, this re-use permits the use of `CMAKE_DEBUG_POSTFIX` to have the import library and the DLL be named with the trailing suffix but have the same import name for the swift module and interface.
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx23
1 files changed, 10 insertions, 13 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 06063b2..31afd9e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -814,10 +814,15 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
return targetNames.Base;
}();
- vars["SWIFT_MODULE"] = [this]() -> std::string {
- cmGeneratorTarget::Names targetNames =
- this->GetGeneratorTarget()->GetLibraryNames(this->GetConfigName());
+ vars["SWIFT_MODULE_NAME"] = [this]() -> std::string {
+ if (const char* name =
+ this->GetGeneratorTarget()->GetProperty("Swift_MODULE_NAME")) {
+ return name;
+ }
+ return this->GetGeneratorTarget()->GetName();
+ }();
+ vars["SWIFT_MODULE"] = [this](const std::string& module) -> std::string {
std::string directory =
this->GetLocalGenerator()->GetCurrentBinaryDirectory();
if (const char* prop = this->GetGeneratorTarget()->GetProperty(
@@ -825,7 +830,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
directory = prop;
}
- std::string name = targetNames.Base + ".swiftmodule";
+ std::string name = module + ".swiftmodule";
if (const char* prop =
this->GetGeneratorTarget()->GetProperty("Swift_MODULE")) {
name = prop;
@@ -834,15 +839,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
return this->GetLocalGenerator()->ConvertToOutputFormat(
this->ConvertToNinjaPath(directory + "/" + name),
cmOutputConverter::SHELL);
- }();
-
- vars["SWIFT_MODULE_NAME"] = [this]() -> std::string {
- if (const char* name =
- this->GetGeneratorTarget()->GetProperty("Swift_MODULE_NAME")) {
- return name;
- }
- return this->GetGeneratorTarget()->GetName();
- }();
+ }(vars["SWIFT_MODULE_NAME"]);
vars["SWIFT_OUTPUT_FILE_MAP"] =
this->GetLocalGenerator()->ConvertToOutputFormat(