ENH: move AddFlags stuff up to LocalGenerator from LocalUnix generator
This commit is contained in:
parent
0aa05c1f7b
commit
35ec09480a
|
@ -1267,3 +1267,74 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
|
|||
fout << m_Makefile->GetDefinition("CMAKE_STANDARD_LIBRARIES") << " ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalGenerator::AddLanguageFlags(std::string& flags,
|
||||
const char* lang)
|
||||
{
|
||||
// Add language-specific flags.
|
||||
std::string flagsVar = "CMAKE_";
|
||||
flagsVar += lang;
|
||||
flagsVar += "_FLAGS";
|
||||
this->AddConfigVariableFlags(flags, flagsVar.c_str());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalGenerator::AddSharedFlags(std::string& flags,
|
||||
const char* lang,
|
||||
bool shared)
|
||||
{
|
||||
std::string flagsVar;
|
||||
|
||||
// Add flags for dealing with shared libraries for this language.
|
||||
if(shared)
|
||||
{
|
||||
flagsVar = "CMAKE_SHARED_LIBRARY_";
|
||||
flagsVar += lang;
|
||||
flagsVar += "_FLAGS";
|
||||
this->AppendFlags(flags, m_Makefile->GetDefinition(flagsVar.c_str()));
|
||||
}
|
||||
|
||||
// Add flags specific to shared builds.
|
||||
if(cmSystemTools::IsOn(m_Makefile->GetDefinition("BUILD_SHARED_LIBS")))
|
||||
{
|
||||
flagsVar = "CMAKE_SHARED_BUILD_";
|
||||
flagsVar += lang;
|
||||
flagsVar += "_FLAGS";
|
||||
this->AppendFlags(flags, m_Makefile->GetDefinition(flagsVar.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
|
||||
const char* var)
|
||||
{
|
||||
// Add the flags from the variable itself.
|
||||
std::string flagsVar = var;
|
||||
this->AppendFlags(flags, m_Makefile->GetDefinition(flagsVar.c_str()));
|
||||
|
||||
// Add the flags from the build-type specific variable.
|
||||
const char* buildType = m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
||||
if(buildType && *buildType)
|
||||
{
|
||||
flagsVar += "_";
|
||||
flagsVar += cmSystemTools::UpperCase(buildType);
|
||||
this->AppendFlags(flags, m_Makefile->GetDefinition(flagsVar.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalGenerator::AppendFlags(std::string& flags,
|
||||
const char* newFlags)
|
||||
{
|
||||
if(newFlags && *newFlags)
|
||||
{
|
||||
if(flags.size())
|
||||
{
|
||||
flags += " ";
|
||||
}
|
||||
flags += newFlags;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,11 @@ public:
|
|||
void SetParent(cmLocalGenerator* g) { m_Parent = g;}
|
||||
|
||||
protected:
|
||||
void AddLanguageFlags(std::string& flags, const char* lang);
|
||||
void AddSharedFlags(std::string& flags, const char* lang, bool shared);
|
||||
void AddConfigVariableFlags(std::string& flags, const char* var);
|
||||
void AppendFlags(std::string& flags, const char* newFlags);
|
||||
|
||||
///! Fill out these strings for the given target. Libraries to link, flags, and linkflags.
|
||||
void GetTargetFlags(std::string& linkLibs,
|
||||
std::string& flags,
|
||||
|
|
|
@ -2307,75 +2307,6 @@ bool cmLocalUnixMakefileGenerator2::ComparePath(const char* c1, const char* c2)
|
|||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalUnixMakefileGenerator2::AddLanguageFlags(std::string& flags,
|
||||
const char* lang)
|
||||
{
|
||||
// Add language-specific flags.
|
||||
std::string flagsVar = "CMAKE_";
|
||||
flagsVar += lang;
|
||||
flagsVar += "_FLAGS";
|
||||
this->AddConfigVariableFlags(flags, flagsVar.c_str());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalUnixMakefileGenerator2::AddSharedFlags(std::string& flags,
|
||||
const char* lang,
|
||||
bool shared)
|
||||
{
|
||||
std::string flagsVar;
|
||||
|
||||
// Add flags for dealing with shared libraries for this language.
|
||||
if(shared)
|
||||
{
|
||||
flagsVar = "CMAKE_SHARED_LIBRARY_";
|
||||
flagsVar += lang;
|
||||
flagsVar += "_FLAGS";
|
||||
this->AppendFlags(flags, m_Makefile->GetDefinition(flagsVar.c_str()));
|
||||
}
|
||||
|
||||
// Add flags specific to shared builds.
|
||||
if(cmSystemTools::IsOn(m_Makefile->GetDefinition("BUILD_SHARED_LIBS")))
|
||||
{
|
||||
flagsVar = "CMAKE_SHARED_BUILD_";
|
||||
flagsVar += lang;
|
||||
flagsVar += "_FLAGS";
|
||||
this->AppendFlags(flags, m_Makefile->GetDefinition(flagsVar.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalUnixMakefileGenerator2::AddConfigVariableFlags(std::string& flags,
|
||||
const char* var)
|
||||
{
|
||||
// Add the flags from the variable itself.
|
||||
std::string flagsVar = var;
|
||||
this->AppendFlags(flags, m_Makefile->GetDefinition(flagsVar.c_str()));
|
||||
|
||||
// Add the flags from the build-type specific variable.
|
||||
const char* buildType = m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
||||
if(buildType && *buildType)
|
||||
{
|
||||
flagsVar += "_";
|
||||
flagsVar += cmSystemTools::UpperCase(buildType);
|
||||
this->AppendFlags(flags, m_Makefile->GetDefinition(flagsVar.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalUnixMakefileGenerator2::AppendFlags(std::string& flags,
|
||||
const char* newFlags)
|
||||
{
|
||||
if(newFlags && *newFlags)
|
||||
{
|
||||
if(flags.size())
|
||||
{
|
||||
flags += " ";
|
||||
}
|
||||
flags += newFlags;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
cmLocalUnixMakefileGenerator2
|
||||
|
|
|
@ -159,10 +159,6 @@ protected:
|
|||
void SplitFullPath(const char* p, std::vector<std::string>& components);
|
||||
bool ComparePath(const char* c1, const char* c2);
|
||||
|
||||
void AddLanguageFlags(std::string& flags, const char* lang);
|
||||
void AddSharedFlags(std::string& flags, const char* lang, bool shared);
|
||||
void AddConfigVariableFlags(std::string& flags, const char* var);
|
||||
void AppendFlags(std::string& flags, const char* newFlags);
|
||||
void AppendTargetDepends(std::vector<std::string>& depends,
|
||||
const cmTarget& target);
|
||||
void AppendAnyDepend(std::vector<std::string>& depends, const char* name);
|
||||
|
|
Loading…
Reference in New Issue