summaryrefslogtreecommitdiffstats
path: root/Source/cmCommonTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-09 20:28:14 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-09 21:25:14 (GMT)
commit25d261efa7c80ce7d9cbcb8b94d5d4a77cb12aaf (patch)
treed6b00210307b010f08388a337fdb5b879be25bd3 /Source/cmCommonTargetGenerator.cxx
parent1e0a9ac45d51e0076222026b9c44604b287a6eae (diff)
downloadCMake-25d261efa7c80ce7d9cbcb8b94d5d4a77cb12aaf.zip
CMake-25d261efa7c80ce7d9cbcb8b94d5d4a77cb12aaf.tar.gz
CMake-25d261efa7c80ce7d9cbcb8b94d5d4a77cb12aaf.tar.bz2
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 239582f..fd1ad36 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);
}