summaryrefslogtreecommitdiff
path: root/Source/cmCommonTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-09 15:28:14 -0500
committerBrad King <brad.king@kitware.com>2017-03-09 16:25:14 -0500
commit25d261efa7c80ce7d9cbcb8b94d5d4a77cb12aaf (patch)
treed6b00210307b010f08388a337fdb5b879be25bd3 /Source/cmCommonTargetGenerator.cxx
parent1e0a9ac45d51e0076222026b9c44604b287a6eae (diff)
downloadcmake-25d261efa7c80ce7d9cbcb8b94d5d4a77cb12aaf.tar.gz
Refactor module definition file selection
Create a `ModuleDefinitionInfo` structure for each configuration of a target to hold corresponding information about the selected module definition file (`.def` source).
Diffstat (limited to 'Source/cmCommonTargetGenerator.cxx')
-rw-r--r--Source/cmCommonTargetGenerator.cxx15
1 files changed, 4 insertions, 11 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 239582f83f..fd1ad36637 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -26,7 +26,6 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
, GlobalGenerator(static_cast<cmGlobalCommonGenerator*>(
gt->LocalGenerator->GetGlobalGenerator()))
, ConfigName(LocalGenerator->GetConfigName())
- , ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName))
{
}
@@ -63,14 +62,9 @@ void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags,
void cmCommonTargetGenerator::AddModuleDefinitionFlag(
cmLinkLineComputer* linkLineComputer, std::string& flags)
{
- // A module definition file only makes sense on certain target types.
- if (this->GeneratorTarget->GetType() != cmStateEnums::SHARED_LIBRARY &&
- this->GeneratorTarget->GetType() != cmStateEnums::MODULE_LIBRARY &&
- this->GeneratorTarget->GetType() != cmStateEnums::EXECUTABLE) {
- return;
- }
-
- if (!this->ModuleDefinitionFile) {
+ cmGeneratorTarget::ModuleDefinitionInfo const* mdi =
+ this->GeneratorTarget->GetModuleDefinitionInfo(this->GetConfigName());
+ if (!mdi || mdi->DefFile.empty()) {
return;
}
@@ -85,8 +79,7 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(
// vs6's "cl -link" pass it to the linker.
std::string flag = defFileFlag;
flag += this->LocalGenerator->ConvertToOutputFormat(
- linkLineComputer->ConvertToLinkReference(
- this->ModuleDefinitionFile->GetFullPath()),
+ linkLineComputer->ConvertToLinkReference(mdi->DefFile),
cmOutputConverter::SHELL);
this->LocalGenerator->AppendFlags(flags, flag);
}