Allow directory names containing '=' and warn if necessary (#12934)
The approach taken by commit 8704525f
(Reject directory names containing
'=', 2011-01-14) was perhaps too heavy-handed for avoiding the obscure
cases when '=' in the path fails due to limitations of Make syntax.
Only two CMake tests:
LinkDirectory
OutOfSource
fail when the path contains '=' and they cover obscure cases. Instead
of rejecting such paths outright just warn when the problem may occur.
This commit is contained in:
parent
8704525f20
commit
c8ef6430e0
|
@ -561,6 +561,21 @@ cmLocalUnixMakefileGenerator3
|
||||||
space = " ";
|
space = " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Warn about paths not supported by Make tools.
|
||||||
|
std::string::size_type pos = tgt.find_first_of("=");
|
||||||
|
if(pos != std::string::npos)
|
||||||
|
{
|
||||||
|
cmOStringStream m;
|
||||||
|
m <<
|
||||||
|
"Make rule for\n"
|
||||||
|
" " << tgt << "\n"
|
||||||
|
"has '=' on left hand side. "
|
||||||
|
"The make tool may not support this.";
|
||||||
|
cmListFileBacktrace bt;
|
||||||
|
this->GlobalGenerator->GetCMakeInstance()
|
||||||
|
->IssueMessage(cmake::WARNING, m.str(), bt);
|
||||||
|
}
|
||||||
|
|
||||||
// Mark the rule as symbolic if requested.
|
// Mark the rule as symbolic if requested.
|
||||||
if(symbolic)
|
if(symbolic)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1946,32 +1946,8 @@ int cmake::Configure()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmake::RejectUnsupportedPaths(const char* desc, std::string const& path)
|
|
||||||
{
|
|
||||||
// Some characters are not well-supported by native build systems.
|
|
||||||
std::string::size_type pos = path.find_first_of("=");
|
|
||||||
if(pos == std::string::npos)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
cmOStringStream e;
|
|
||||||
e << "The path to the " << desc << " directory:\n"
|
|
||||||
<< " " << path << "\n"
|
|
||||||
<< "contains unsupported character '" << path[pos] << "'.\n"
|
|
||||||
<< "Please use a different " << desc << " directory name.";
|
|
||||||
cmListFileBacktrace bt;
|
|
||||||
this->IssueMessage(cmake::FATAL_ERROR, e.str(), bt);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cmake::ActualConfigure()
|
int cmake::ActualConfigure()
|
||||||
{
|
{
|
||||||
if(this->RejectUnsupportedPaths("source", this->cmHomeDirectory) ||
|
|
||||||
this->RejectUnsupportedPaths("binary", this->HomeOutputDirectory))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct right now our path conversion table before it's too late:
|
// Construct right now our path conversion table before it's too late:
|
||||||
this->UpdateConversionPathTable();
|
this->UpdateConversionPathTable();
|
||||||
this->CleanupCommandsAndMacros();
|
this->CleanupCommandsAndMacros();
|
||||||
|
|
|
@ -435,8 +435,6 @@ protected:
|
||||||
|
|
||||||
///! Find the full path to one of the cmake programs like ctest, cpack, etc.
|
///! Find the full path to one of the cmake programs like ctest, cpack, etc.
|
||||||
std::string FindCMakeProgram(const char* name) const;
|
std::string FindCMakeProgram(const char* name) const;
|
||||||
|
|
||||||
bool RejectUnsupportedPaths(const char* desc, std::string const& path);
|
|
||||||
private:
|
private:
|
||||||
cmake(const cmake&); // Not implemented.
|
cmake(const cmake&); // Not implemented.
|
||||||
void operator=(const cmake&); // Not implemented.
|
void operator=(const cmake&); // Not implemented.
|
||||||
|
|
Loading…
Reference in New Issue