BUG: Fix logic that loops over multiple output pairs to not loop beyond the vector when there are an odd number of entries.
This commit is contained in:
parent
ffbe61bb11
commit
09dd298f63
@ -1525,28 +1525,25 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
|
|||||||
std::vector<std::string> pairs;
|
std::vector<std::string> pairs;
|
||||||
cmSystemTools::ExpandListArgument(pairs_string, pairs, true);
|
cmSystemTools::ExpandListArgument(pairs_string, pairs, true);
|
||||||
for(std::vector<std::string>::const_iterator i = pairs.begin();
|
for(std::vector<std::string>::const_iterator i = pairs.begin();
|
||||||
i != pairs.end(); ++i)
|
i != pairs.end() && (i+1) != pairs.end();)
|
||||||
{
|
{
|
||||||
const std::string& depender = *i;
|
const std::string& depender = *i++;
|
||||||
if(++i != pairs.end())
|
const std::string& dependee = *i++;
|
||||||
{
|
|
||||||
const std::string& dependee = *i;
|
|
||||||
|
|
||||||
// If the depender is missing then delete the dependee to make
|
// If the depender is missing then delete the dependee to make
|
||||||
// sure both will be regenerated.
|
// sure both will be regenerated.
|
||||||
if(cmSystemTools::FileExists(dependee.c_str()) &&
|
if(cmSystemTools::FileExists(dependee.c_str()) &&
|
||||||
!cmSystemTools::FileExists(depender.c_str()))
|
!cmSystemTools::FileExists(depender.c_str()))
|
||||||
|
{
|
||||||
|
if(verbose)
|
||||||
{
|
{
|
||||||
if(verbose)
|
cmOStringStream msg;
|
||||||
{
|
msg << "Deleting primary custom command output \"" << dependee
|
||||||
cmOStringStream msg;
|
<< "\" because another output \""
|
||||||
msg << "Deleting primary custom command output \"" << dependee
|
<< depender << "\" does not exist." << std::endl;
|
||||||
<< "\" because another output \""
|
cmSystemTools::Stdout(msg.str().c_str());
|
||||||
<< depender << "\" does not exist." << std::endl;
|
|
||||||
cmSystemTools::Stdout(msg.str().c_str());
|
|
||||||
}
|
|
||||||
cmSystemTools::RemoveFile(dependee.c_str());
|
|
||||||
}
|
}
|
||||||
|
cmSystemTools::RemoveFile(dependee.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user