refactor flags and defines
This commit is contained in:
parent
00f88cc095
commit
3f064efe40
|
@ -249,6 +249,66 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) {
|
||||||
|
std::string flags;
|
||||||
|
const char *lang = l.c_str();
|
||||||
|
|
||||||
|
bool shared = ((this->Target->GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
|
(this->Target->GetType() == cmTarget::MODULE_LIBRARY));
|
||||||
|
|
||||||
|
// Add language feature flags.
|
||||||
|
this->AddFeatureFlags(flags, lang);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
// Add include directory flags.
|
||||||
|
this->AddIncludeFlags(flags, lang);
|
||||||
|
|
||||||
|
// Append old-style preprocessor definition flags.
|
||||||
|
this->LocalGenerator->
|
||||||
|
AppendFlags(flags, this->Makefile->GetDefineFlags());
|
||||||
|
|
||||||
|
// Add include directory flags.
|
||||||
|
this->LocalGenerator->
|
||||||
|
AppendFlags(flags,this->GetFrameworkFlags().c_str());
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
|
void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
|
||||||
{
|
{
|
||||||
// write language flags for target
|
// write language flags for target
|
||||||
|
@ -269,59 +329,9 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
|
||||||
for(std::set<cmStdString>::const_iterator l = languages.begin();
|
for(std::set<cmStdString>::const_iterator l = languages.begin();
|
||||||
l != languages.end(); ++l)
|
l != languages.end(); ++l)
|
||||||
{
|
{
|
||||||
const char *lang = l->c_str();
|
*this->FlagFileStream << *l << "_FLAGS = " << this->GetFlags(*l) << "\n\n";
|
||||||
std::string flags;
|
*this->FlagFileStream << *l << "_DEFINES = " << this->GetDefines(*l) <<
|
||||||
std::string defines;
|
"\n\n";
|
||||||
bool shared = ((this->Target->GetType() == cmTarget::SHARED_LIBRARY) ||
|
|
||||||
(this->Target->GetType() == cmTarget::MODULE_LIBRARY));
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
// Add language feature flags.
|
|
||||||
this->AddFeatureFlags(flags, lang);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
// Add include directory flags.
|
|
||||||
this->AddIncludeFlags(flags, lang);
|
|
||||||
|
|
||||||
// Append old-style preprocessor definition flags.
|
|
||||||
this->LocalGenerator->
|
|
||||||
AppendFlags(flags, this->Makefile->GetDefineFlags());
|
|
||||||
|
|
||||||
// Add include directory flags.
|
|
||||||
this->LocalGenerator->
|
|
||||||
AppendFlags(flags,this->GetFrameworkFlags().c_str());
|
|
||||||
|
|
||||||
*this->FlagFileStream << lang << "_FLAGS = " << flags << "\n\n";
|
|
||||||
*this->FlagFileStream << lang << "_DEFINES = " << defines << "\n\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add target-specific flags.
|
// Add target-specific flags.
|
||||||
|
|
|
@ -216,6 +216,9 @@ protected:
|
||||||
std::string MacContentDirectory;
|
std::string MacContentDirectory;
|
||||||
std::set<cmStdString> MacContentFolders;
|
std::set<cmStdString> MacContentFolders;
|
||||||
|
|
||||||
|
std::string GetFlags(const std::string &l);
|
||||||
|
std::string GetDefines(const std::string &l);
|
||||||
|
|
||||||
// Target-wide Fortran module output directory.
|
// Target-wide Fortran module output directory.
|
||||||
bool FortranModuleDirectoryComputed;
|
bool FortranModuleDirectoryComputed;
|
||||||
std::string FortranModuleDirectory;
|
std::string FortranModuleDirectory;
|
||||||
|
|
Loading…
Reference in New Issue