Commit 205fce61 authored by Brad King's avatar Brad King
Browse files

ENH: Warn if build dir is too long for filesystem

When an object file directory is too deep to place an object file
without exceeding CMAKE_OBJECT_PATH_MAX, this issues a warning.
Previously we silently ignored the problem.  See issue #7860.
parent 3cf9265f
...@@ -136,6 +136,7 @@ void cmLocalGenerator::Configure() ...@@ -136,6 +136,7 @@ void cmLocalGenerator::Configure()
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
} }
} }
this->ObjectMaxPathViolations.clear();
} }
this->Configured = true; this->Configured = true;
...@@ -2536,8 +2537,26 @@ cmLocalGenerator ...@@ -2536,8 +2537,26 @@ cmLocalGenerator
} }
#if defined(CM_LG_ENCODE_OBJECT_NAMES) #if defined(CM_LG_ENCODE_OBJECT_NAMES)
cmLocalGeneratorCheckObjectName(ssin, dir_max.size(), if(!cmLocalGeneratorCheckObjectName(ssin, dir_max.size(),
this->ObjectPathMax); this->ObjectPathMax))
{
// Warn if this is the first time the path has been seen.
if(this->ObjectMaxPathViolations.insert(dir_max).second)
{
cmOStringStream m;
m << "The object file directory\n"
<< " " << dir_max << "\n"
<< "has " << dir_max.size() << " characters. "
<< "The maximum full path to an object file is "
<< this->ObjectPathMax << " characters "
<< "(see CMAKE_OBJECT_PATH_MAX). "
<< "Object file\n"
<< " " << ssin << "\n"
<< "cannot be safely placed under this directory. "
<< "The build may not work correctly.";
this->Makefile->IssueMessage(cmake::WARNING, m.str());
}
}
#else #else
(void)dir_max; (void)dir_max;
#endif #endif
......
...@@ -370,6 +370,7 @@ protected: ...@@ -370,6 +370,7 @@ protected:
std::map<cmStdString, cmStdString> LanguageToIncludeFlags; std::map<cmStdString, cmStdString> LanguageToIncludeFlags;
std::map<cmStdString, cmStdString> UniqueObjectNamesMap; std::map<cmStdString, cmStdString> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax; std::string::size_type ObjectPathMax;
std::set<cmStdString> ObjectMaxPathViolations;
bool WindowsShell; bool WindowsShell;
bool WindowsVSIDE; bool WindowsVSIDE;
bool WatcomWMake; bool WatcomWMake;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment