ENH: make sure RuleVariable struct is initialized correctly, also make sure custom command targets do not crash cmake
This commit is contained in:
parent
c3a22c011d
commit
8f1aaf28c1
@ -617,7 +617,11 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
|
|||||||
vars.LinkLibraries = linkLibs.c_str();
|
vars.LinkLibraries = linkLibs.c_str();
|
||||||
vars.Flags = flags.c_str();
|
vars.Flags = flags.c_str();
|
||||||
vars.LinkFlags = linkFlags.c_str();
|
vars.LinkFlags = linkFlags.c_str();
|
||||||
|
|
||||||
|
std::string langFlags;
|
||||||
|
this->AddLanguageFlags(langFlags, llang, 0);
|
||||||
|
vars.LanguageCompileFlags = langFlags.c_str();
|
||||||
|
|
||||||
cmCustomCommandLines commandLines;
|
cmCustomCommandLines commandLines;
|
||||||
std::vector<std::string> rules;
|
std::vector<std::string> rules;
|
||||||
rules.push_back(this->Makefile->GetRequiredDefinition(createRule.c_str()));
|
rules.push_back(this->Makefile->GetRequiredDefinition(createRule.c_str()));
|
||||||
@ -812,30 +816,39 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
|
|||||||
return targetQuoted;
|
return targetQuoted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(variable == "LANGUAGE_COMPILE_FLAGS")
|
if(replaceValues.LanguageCompileFlags)
|
||||||
{
|
{
|
||||||
return replaceValues.LanguageCompileFlags;
|
if(variable == "LANGUAGE_COMPILE_FLAGS")
|
||||||
|
{
|
||||||
|
return replaceValues.LanguageCompileFlags;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(variable == "TARGET")
|
if(replaceValues.Target)
|
||||||
{
|
{
|
||||||
return replaceValues.Target;
|
if(variable == "TARGET")
|
||||||
|
{
|
||||||
|
return replaceValues.Target;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(variable == "TARGET_IMPLIB")
|
if(variable == "TARGET_IMPLIB")
|
||||||
{
|
{
|
||||||
return this->TargetImplib;
|
return this->TargetImplib;
|
||||||
}
|
}
|
||||||
if(variable == "TARGET_BASE")
|
if(replaceValues.Target)
|
||||||
{
|
{
|
||||||
// Strip the last extension off the target name.
|
if(variable == "TARGET_BASE")
|
||||||
std::string targetBase = replaceValues.Target;
|
|
||||||
std::string::size_type pos = targetBase.rfind(".");
|
|
||||||
if(pos != targetBase.npos)
|
|
||||||
{
|
{
|
||||||
|
// Strip the last extension off the target name.
|
||||||
|
std::string targetBase = replaceValues.Target;
|
||||||
|
std::string::size_type pos = targetBase.rfind(".");
|
||||||
|
if(pos != targetBase.npos)
|
||||||
|
{
|
||||||
return targetBase.substr(0, pos);
|
return targetBase.substr(0, pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return targetBase;
|
return targetBase;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,20 +181,7 @@ public:
|
|||||||
{
|
{
|
||||||
RuleVariables()
|
RuleVariables()
|
||||||
{
|
{
|
||||||
this->Language= 0;
|
memset(this, 0, sizeof(*this));
|
||||||
this->Objects= 0;
|
|
||||||
this->Target= 0;
|
|
||||||
this->LinkLibraries= 0;
|
|
||||||
this->Source= 0;
|
|
||||||
this->AssemblySource = 0;
|
|
||||||
this->PreprocessedSource = 0;
|
|
||||||
this->Object= 0;
|
|
||||||
this->ObjectDir= 0;
|
|
||||||
this->Flags= 0;
|
|
||||||
this->ObjectsQuoted= 0;
|
|
||||||
this->TargetSOName= 0;
|
|
||||||
this->TargetInstallNameDir = 0;
|
|
||||||
this->LinkFlags= 0;
|
|
||||||
}
|
}
|
||||||
const char* TargetPDB;
|
const char* TargetPDB;
|
||||||
const char* Language;
|
const char* Language;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user