cache flags and defines
This commit is contained in:
parent
3f064efe40
commit
65c0c24a29
|
@ -250,63 +250,70 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) {
|
std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) {
|
||||||
std::string flags;
|
std::pair<std::map<std::string, std::string>::iterator, bool>
|
||||||
const char *lang = l.c_str();
|
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) ||
|
bool shared = ((this->Target->GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
(this->Target->GetType() == cmTarget::MODULE_LIBRARY));
|
(this->Target->GetType() == cmTarget::MODULE_LIBRARY));
|
||||||
|
|
||||||
// Add language feature flags.
|
// Add language feature flags.
|
||||||
this->AddFeatureFlags(flags, lang);
|
this->AddFeatureFlags(flags, lang);
|
||||||
|
|
||||||
this->LocalGenerator->AddArchitectureFlags(flags, this->Target,
|
this->LocalGenerator->AddArchitectureFlags(flags, this->Target,
|
||||||
lang, this->ConfigName);
|
lang, this->ConfigName);
|
||||||
|
|
||||||
// Fortran-specific flags computed for this target.
|
// Fortran-specific flags computed for this target.
|
||||||
if(l == "Fortran")
|
if(l == "Fortran")
|
||||||
{
|
{
|
||||||
this->AddFortranFlags(flags);
|
this->AddFortranFlags(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add shared-library flags if needed.
|
// Add shared-library flags if needed.
|
||||||
this->LocalGenerator->AddSharedFlags(flags, lang, shared);
|
this->LocalGenerator->AddSharedFlags(flags, lang, shared);
|
||||||
|
|
||||||
// Add include directory flags.
|
// Add include directory flags.
|
||||||
this->AddIncludeFlags(flags, lang);
|
this->AddIncludeFlags(flags, lang);
|
||||||
|
|
||||||
// Append old-style preprocessor definition flags.
|
// Append old-style preprocessor definition flags.
|
||||||
this->LocalGenerator->
|
this->LocalGenerator->
|
||||||
AppendFlags(flags, this->Makefile->GetDefineFlags());
|
AppendFlags(flags, this->Makefile->GetDefineFlags());
|
||||||
|
|
||||||
// Add include directory flags.
|
// Add include directory flags.
|
||||||
this->LocalGenerator->
|
this->LocalGenerator->
|
||||||
AppendFlags(flags,this->GetFrameworkFlags().c_str());
|
AppendFlags(flags,this->GetFrameworkFlags().c_str());
|
||||||
|
}
|
||||||
return flags;
|
return insert_result.first->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) {
|
std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) {
|
||||||
std::string defines;
|
std::pair<std::map<std::string, std::string>::iterator, bool>
|
||||||
const char *lang = l.c_str();
|
insert_result = this->DefinesByLanguage.insert(std::make_pair(l, ""));
|
||||||
// Add the export symbol definition for shared library objects.
|
if (insert_result.second) {
|
||||||
if(const char* exportMacro = this->Target->GetExportMacro())
|
std::string &defines = insert_result.first->second;
|
||||||
{
|
const char *lang = l.c_str();
|
||||||
this->LocalGenerator->AppendDefines(defines, exportMacro, lang);
|
// 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.
|
// Add preprocessor definitions for this target and configuration.
|
||||||
this->LocalGenerator->AppendDefines
|
this->LocalGenerator->AppendDefines
|
||||||
(defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS"), lang);
|
(defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS"), lang);
|
||||||
this->LocalGenerator->AppendDefines
|
this->LocalGenerator->AppendDefines
|
||||||
(defines, this->Target->GetProperty("COMPILE_DEFINITIONS"), lang);
|
(defines, this->Target->GetProperty("COMPILE_DEFINITIONS"), lang);
|
||||||
std::string defPropName = "COMPILE_DEFINITIONS_";
|
std::string defPropName = "COMPILE_DEFINITIONS_";
|
||||||
defPropName +=
|
defPropName +=
|
||||||
cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName);
|
cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName);
|
||||||
this->LocalGenerator->AppendDefines
|
this->LocalGenerator->AppendDefines
|
||||||
(defines, this->Makefile->GetProperty(defPropName.c_str()), lang);
|
(defines, this->Makefile->GetProperty(defPropName.c_str()), lang);
|
||||||
this->LocalGenerator->AppendDefines
|
this->LocalGenerator->AppendDefines
|
||||||
(defines, this->Target->GetProperty(defPropName.c_str()), lang);
|
(defines, this->Target->GetProperty(defPropName.c_str()), lang);
|
||||||
return defines;
|
}
|
||||||
|
return insert_result.first->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
|
void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
|
||||||
|
|
|
@ -217,7 +217,9 @@ protected:
|
||||||
std::set<cmStdString> MacContentFolders;
|
std::set<cmStdString> MacContentFolders;
|
||||||
|
|
||||||
std::string GetFlags(const std::string &l);
|
std::string GetFlags(const std::string &l);
|
||||||
|
std::map<std::string, std::string> FlagsByLanguage;
|
||||||
std::string GetDefines(const std::string &l);
|
std::string GetDefines(const std::string &l);
|
||||||
|
std::map<std::string, std::string> DefinesByLanguage;
|
||||||
|
|
||||||
// Target-wide Fortran module output directory.
|
// Target-wide Fortran module output directory.
|
||||||
bool FortranModuleDirectoryComputed;
|
bool FortranModuleDirectoryComputed;
|
||||||
|
|
Loading…
Reference in New Issue