summaryrefslogtreecommitdiffstats
path: root/Source/cmCommonTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-07-08 19:24:17 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-09 13:50:06 (GMT)
commitcdb5b65752c5a009ac3bb7425637da808a7a9bca (patch)
tree14c31339b4c0c384bec7afc61d40b247fe5a611a /Source/cmCommonTargetGenerator.cxx
parentbeee79373222ea01008cd137dd9a3ffa59cbe347 (diff)
downloadCMake-cdb5b65752c5a009ac3bb7425637da808a7a9bca.zip
CMake-cdb5b65752c5a009ac3bb7425637da808a7a9bca.tar.gz
CMake-cdb5b65752c5a009ac3bb7425637da808a7a9bca.tar.bz2
cmCommonTargetGenerator: Adopt ModuleDefinitionFile member
De-duplicate the ModuleDefinitionFile and AddModuleDefinitionFlag members from the Makefile and Ninja target generators.
Diffstat (limited to 'Source/cmCommonTargetGenerator.cxx')
-rw-r--r--Source/cmCommonTargetGenerator.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 34982b0..84a35a8 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -14,6 +14,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalCommonGenerator.h"
#include "cmLocalCommonGenerator.h"
+#include "cmMakefile.h"
#include "cmTarget.h"
cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
@@ -24,6 +25,7 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
, GlobalGenerator(static_cast<cmGlobalCommonGenerator*>(
gt->LocalGenerator->GetGlobalGenerator()))
, ConfigName(LocalGenerator->GetConfigName())
+ , ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName))
{
}
@@ -61,3 +63,27 @@ void cmCommonTargetGenerator::AddFeatureFlags(
this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
}
}
+
+//----------------------------------------------------------------------------
+void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
+{
+ if(this->ModuleDefinitionFile.empty())
+ {
+ return;
+ }
+
+ // TODO: Create a per-language flag variable.
+ const char* defFileFlag =
+ this->Makefile->GetDefinition("CMAKE_LINK_DEF_FILE_FLAG");
+ if(!defFileFlag)
+ {
+ return;
+ }
+
+ // Append the flag and value. Use ConvertToLinkReference to help
+ // vs6's "cl -link" pass it to the linker.
+ std::string flag = defFileFlag;
+ flag += (this->LocalGenerator->ConvertToLinkReference(
+ this->ModuleDefinitionFile));
+ this->LocalGenerator->AppendFlags(flags, flag);
+}