diff options
author | Manuel Klimek <klimek@google.com> | 2011-01-14 22:28:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2011-04-25 17:27:58 (GMT) |
commit | 65c0c24a296c12c8037361cc5c53d884c4cde5f0 (patch) | |
tree | 46c732c068bf8b01d46cc1e7454866c16fda7d79 /Source/cmMakefileTargetGenerator.cxx | |
parent | 3f064efe40cdf9d2eac955581b171e0c723e92a2 (diff) | |
download | CMake-65c0c24a296c12c8037361cc5c53d884c4cde5f0.zip CMake-65c0c24a296c12c8037361cc5c53d884c4cde5f0.tar.gz CMake-65c0c24a296c12c8037361cc5c53d884c4cde5f0.tar.bz2 |
cache flags and defines
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 97 |
1 files changed, 52 insertions, 45 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 01545fc..1c45f18 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -250,63 +250,70 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() //---------------------------------------------------------------------------- std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) { - std::string flags; - const char *lang = l.c_str(); + std::pair<std::map<std::string, std::string>::iterator, bool> + insert_result = this->FlagsByLanguage.insert(std::make_pair(l, "")); + if (insert_result.second) { + std::string& flags = insert_result.first->second; + const char *lang = l.c_str(); - bool shared = ((this->Target->GetType() == cmTarget::SHARED_LIBRARY) || - (this->Target->GetType() == cmTarget::MODULE_LIBRARY)); + bool shared = ((this->Target->GetType() == cmTarget::SHARED_LIBRARY) || + (this->Target->GetType() == cmTarget::MODULE_LIBRARY)); - // Add language feature flags. - this->AddFeatureFlags(flags, lang); + // Add language feature flags. + this->AddFeatureFlags(flags, lang); - this->LocalGenerator->AddArchitectureFlags(flags, this->Target, - lang, this->ConfigName); + this->LocalGenerator->AddArchitectureFlags(flags, this->Target, + lang, this->ConfigName); - // Fortran-specific flags computed for this target. - if(l == "Fortran") - { - this->AddFortranFlags(flags); - } - - // Add shared-library flags if needed. - this->LocalGenerator->AddSharedFlags(flags, lang, shared); + // Fortran-specific flags computed for this target. + if(l == "Fortran") + { + this->AddFortranFlags(flags); + } - // Add include directory flags. - this->AddIncludeFlags(flags, lang); + // Add shared-library flags if needed. + this->LocalGenerator->AddSharedFlags(flags, lang, shared); - // Append old-style preprocessor definition flags. - this->LocalGenerator-> - AppendFlags(flags, this->Makefile->GetDefineFlags()); + // Add include directory flags. + this->AddIncludeFlags(flags, lang); - // Add include directory flags. - this->LocalGenerator-> - AppendFlags(flags,this->GetFrameworkFlags().c_str()); + // Append old-style preprocessor definition flags. + this->LocalGenerator-> + AppendFlags(flags, this->Makefile->GetDefineFlags()); - return flags; + // Add include directory flags. + this->LocalGenerator-> + AppendFlags(flags,this->GetFrameworkFlags().c_str()); + } + return insert_result.first->second; } std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) { - 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, lang); - } + std::pair<std::map<std::string, std::string>::iterator, bool> + insert_result = this->DefinesByLanguage.insert(std::make_pair(l, "")); + if (insert_result.second) { + std::string &defines = insert_result.first->second; + 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, lang); + } - // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS"), lang); - this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty("COMPILE_DEFINITIONS"), lang); - std::string defPropName = "COMPILE_DEFINITIONS_"; - defPropName += - cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); - this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty(defPropName.c_str()), lang); - this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty(defPropName.c_str()), lang); - return defines; + // Add preprocessor definitions for this target and configuration. + this->LocalGenerator->AppendDefines + (defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS"), lang); + this->LocalGenerator->AppendDefines + (defines, this->Target->GetProperty("COMPILE_DEFINITIONS"), lang); + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += + cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); + this->LocalGenerator->AppendDefines + (defines, this->Makefile->GetProperty(defPropName.c_str()), lang); + this->LocalGenerator->AppendDefines + (defines, this->Target->GetProperty(defPropName.c_str()), lang); + } + return insert_result.first->second; } void cmMakefileTargetGenerator::WriteTargetLanguageFlags() |