ENH: Added diagnosis of bad target names.
This commit is contained in:
parent
ff46146dfc
commit
6ce165de43
@ -26,6 +26,29 @@ bool cmAddCustomTargetCommand::InitialPass(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check the target name.
|
||||||
|
if(args[0].find_first_of("/\\") != args[0].npos)
|
||||||
|
{
|
||||||
|
int major = 0;
|
||||||
|
int minor = 0;
|
||||||
|
if(const char* versionValue =
|
||||||
|
this->Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"))
|
||||||
|
{
|
||||||
|
sscanf(versionValue, "%d.%d", &major, &minor);
|
||||||
|
}
|
||||||
|
if(!major || major > 3 || (major == 2 && minor > 2))
|
||||||
|
{
|
||||||
|
cmOStringStream e;
|
||||||
|
e << "called with invalid target name \"" << args[0]
|
||||||
|
<< "\". Target names may not contain a slash. "
|
||||||
|
<< "Use ADD_CUSTOM_COMMAND to generate files. "
|
||||||
|
<< "Set CMAKE_BACKWARDS_COMPATIBILITY to 2.2 "
|
||||||
|
<< "or lower to skip this check.";
|
||||||
|
this->SetError(e.str().c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Accumulate one command line at a time.
|
// Accumulate one command line at a time.
|
||||||
cmCustomCommandLine currentLine;
|
cmCustomCommandLine currentLine;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user