cmCommonTargetGenerator: Adopt AppendOSXVerFlag method
Move this method from cmMakefileLibraryTargetGenerator so it can be re-used for the Ninja generator too. Signed-off-by: Bruce Stephens <bruce.r.stephens@gmail.com>
This commit is contained in:
parent
8256d021c8
commit
1f2b39c6ce
@ -426,3 +426,35 @@ std::string cmCommonTargetGenerator::GetManifests()
|
|||||||
|
|
||||||
return cmJoin(manifests, " ");
|
return cmJoin(manifests, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmCommonTargetGenerator
|
||||||
|
::AppendOSXVerFlag(std::string& flags, const std::string& lang,
|
||||||
|
const char* name, bool so)
|
||||||
|
{
|
||||||
|
// Lookup the flag to specify the version.
|
||||||
|
std::string fvar = "CMAKE_";
|
||||||
|
fvar += lang;
|
||||||
|
fvar += "_OSX_";
|
||||||
|
fvar += name;
|
||||||
|
fvar += "_VERSION_FLAG";
|
||||||
|
const char* flag = this->Makefile->GetDefinition(fvar);
|
||||||
|
|
||||||
|
// Skip if no such flag.
|
||||||
|
if(!flag)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lookup the target version information.
|
||||||
|
int major;
|
||||||
|
int minor;
|
||||||
|
int patch;
|
||||||
|
this->GeneratorTarget->GetTargetVersion(so, major, minor, patch);
|
||||||
|
if(major > 0 || minor > 0 || patch > 0)
|
||||||
|
{
|
||||||
|
// Append the flag since a non-zero version is specified.
|
||||||
|
std::ostringstream vflag;
|
||||||
|
vflag << flag << major << "." << minor << "." << patch;
|
||||||
|
this->LocalGenerator->AppendFlags(flags, vflag.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -79,6 +79,9 @@ protected:
|
|||||||
virtual void AddIncludeFlags(std::string& flags,
|
virtual void AddIncludeFlags(std::string& flags,
|
||||||
std::string const& lang) = 0;
|
std::string const& lang) = 0;
|
||||||
|
|
||||||
|
void AppendOSXVerFlag(std::string& flags, const std::string& lang,
|
||||||
|
const char* name, bool so);
|
||||||
|
|
||||||
typedef std::map<std::string, std::string> ByLanguageMap;
|
typedef std::map<std::string, std::string> ByLanguageMap;
|
||||||
std::string GetFlags(const std::string &l);
|
std::string GetFlags(const std::string &l);
|
||||||
ByLanguageMap FlagsByLanguage;
|
ByLanguageMap FlagsByLanguage;
|
||||||
|
@ -841,37 +841,3 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||||||
this->CleanFiles.insert(this->CleanFiles.end(),
|
this->CleanFiles.insert(this->CleanFiles.end(),
|
||||||
libCleanFiles.begin(),libCleanFiles.end());
|
libCleanFiles.begin(),libCleanFiles.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void
|
|
||||||
cmMakefileLibraryTargetGenerator
|
|
||||||
::AppendOSXVerFlag(std::string& flags, const std::string& lang,
|
|
||||||
const char* name, bool so)
|
|
||||||
{
|
|
||||||
// Lookup the flag to specify the version.
|
|
||||||
std::string fvar = "CMAKE_";
|
|
||||||
fvar += lang;
|
|
||||||
fvar += "_OSX_";
|
|
||||||
fvar += name;
|
|
||||||
fvar += "_VERSION_FLAG";
|
|
||||||
const char* flag = this->Makefile->GetDefinition(fvar);
|
|
||||||
|
|
||||||
// Skip if no such flag.
|
|
||||||
if(!flag)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup the target version information.
|
|
||||||
int major;
|
|
||||||
int minor;
|
|
||||||
int patch;
|
|
||||||
this->GeneratorTarget->GetTargetVersion(so, major, minor, patch);
|
|
||||||
if(major > 0 || minor > 0 || patch > 0)
|
|
||||||
{
|
|
||||||
// Append the flag since a non-zero version is specified.
|
|
||||||
std::ostringstream vflag;
|
|
||||||
vflag << flag << major << "." << minor << "." << patch;
|
|
||||||
this->LocalGenerator->AppendFlags(flags, vflag.str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -38,9 +38,6 @@ protected:
|
|||||||
|
|
||||||
// Store the computd framework version for OS X Frameworks.
|
// Store the computd framework version for OS X Frameworks.
|
||||||
std::string FrameworkVersion;
|
std::string FrameworkVersion;
|
||||||
|
|
||||||
void AppendOSXVerFlag(std::string& flags, const std::string& lang,
|
|
||||||
const char* name, bool so);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user