diff options
author | Brad King <brad.king@kitware.com> | 2015-07-09 14:10:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-07-09 14:10:25 (GMT) |
commit | eacacacdceb4a259ba76edb2219c7f8e6cb3f47e (patch) | |
tree | aa6c145f2aaecb57c3d50e0c61cb0c6233610cca | |
parent | 0837538e461cfdbc5c673d7f2bf64f6631099bdf (diff) | |
download | CMake-eacacacdceb4a259ba76edb2219c7f8e6cb3f47e.zip CMake-eacacacdceb4a259ba76edb2219c7f8e6cb3f47e.tar.gz CMake-eacacacdceb4a259ba76edb2219c7f8e6cb3f47e.tar.bz2 |
cmCommonTargetGenerator: Adopt GetDefines method
Move the member up from cmMakefileTargetGenerator so it can be re-used
later by cmNinjaTargetGenerator.
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 26 | ||||
-rw-r--r-- | Source/cmCommonTargetGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 26 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.h | 3 |
4 files changed, 28 insertions, 29 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 70e9ce2..ce351ee 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -332,3 +332,29 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l) } return i->second; } + +std::string cmCommonTargetGenerator::GetDefines(const std::string &l) +{ + ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); + if (i == this->DefinesByLanguage.end()) + { + std::set<std::string> defines; + const char *lang = l.c_str(); + // Add the export symbol definition for shared library objects. + if(const char* exportMacro = this->Target->GetExportMacro()) + { + this->LocalGenerator->AppendDefines(defines, exportMacro); + } + + // Add preprocessor definitions for this target and configuration. + this->LocalGenerator->AddCompileDefinitions(defines, this->Target, + this->LocalGenerator->GetConfigName(), l); + + std::string definesString; + this->LocalGenerator->JoinDefines(defines, definesString, lang); + + ByLanguageMap::value_type entry(l, definesString); + i = this->DefinesByLanguage.insert(entry).first; + } + return i->second; +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 5407c61..e184dba 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -81,6 +81,8 @@ protected: typedef std::map<std::string, std::string> ByLanguageMap; std::string GetFlags(const std::string &l); ByLanguageMap FlagsByLanguage; + std::string GetDefines(const std::string &l); + ByLanguageMap DefinesByLanguage; }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 10799c6..ef4bbbe 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -272,32 +272,6 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() << "\n\n"; } -std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) -{ - ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); - if (i == this->DefinesByLanguage.end()) - { - std::set<std::string> defines; - const char *lang = l.c_str(); - // Add the export symbol definition for shared library objects. - if(const char* exportMacro = this->Target->GetExportMacro()) - { - this->LocalGenerator->AppendDefines(defines, exportMacro); - } - - // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->LocalGenerator->GetConfigName(), l); - - std::string definesString; - this->LocalGenerator->JoinDefines(defines, definesString, lang); - - ByLanguageMap::value_type entry(l, definesString); - i = this->DefinesByLanguage.insert(entry).first; - } - return i->second; -} - void cmMakefileTargetGenerator::WriteTargetLanguageFlags() { // write language flags for target diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 9d05cd5..b885672 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -234,9 +234,6 @@ protected: std::set<std::string> MacContentFolders; cmOSXBundleGenerator* OSXBundleGenerator; MacOSXContentGeneratorType* MacOSXContentGenerator; - - std::string GetDefines(const std::string &l); - ByLanguageMap DefinesByLanguage; }; #endif |