include_directories: Fix handling of empty or space-only entries

Since commit 0d46e9a0 (Store includes from the same include_directories
call together., 2013-01-20) we accidentally use such entries.  Fix the
code to drop them instead.  Update the IncludeDirectories test to cover
this case.

Reported-by: Christophe Giboudeaux <cgiboudeaux@gmx.com>
This commit is contained in:
Stephen Kelly
2013-05-20 12:25:59 +02:00
committed by Brad King
parent 5dd8c01429
commit b8cc6f4eba
3 changed files with 28 additions and 2 deletions
+13 -2
View File
@@ -116,13 +116,19 @@ void cmIncludeDirectoryCommand::GetIncludes(const std::string &arg,
{
std::string inc = arg.substr(lastPos,pos);
this->NormalizeInclude(inc);
incs.push_back(inc);
if (!inc.empty())
{
incs.push_back(inc);
}
}
lastPos = pos + 1;
}
std::string inc = arg.substr(lastPos);
this->NormalizeInclude(inc);
incs.push_back(inc);
if (!inc.empty())
{
incs.push_back(inc);
}
}
void cmIncludeDirectoryCommand::NormalizeInclude(std::string &inc)
@@ -133,6 +139,11 @@ void cmIncludeDirectoryCommand::NormalizeInclude(std::string &inc)
{
inc.assign(inc, b, 1+e-b); // copy the remaining substring
}
else
{
inc = "";
return;
}
if (!cmSystemTools::IsOff(inc.c_str()))
{