Commit c332ff41 authored by Brad King's avatar Brad King 💬
Browse files

BUG: Avoid full paths and spaces when constructing object file names.

parent 6018c279
......@@ -929,9 +929,20 @@ cmLocalUnixMakefileGenerator3::CreateSafeUniqueObjectFileName(const char* sin)
// Start with the original name.
std::string ssin = sin;
// Avoid full paths by removing leading slashes.
std::string::size_type pos = 0;
for(;pos < ssin.size() && ssin[pos] == '/'; ++pos);
ssin = ssin.substr(pos);
// Avoid full paths by removing colons.
cmSystemTools::ReplaceString(ssin, ":", "_");
// Avoid relative paths that go up the tree.
cmSystemTools::ReplaceString(ssin, "../", "__/");
// Avoid spaces.
cmSystemTools::ReplaceString(ssin, " ", "_");
// Mangle the name if necessary.
if(m_Makefile->IsOn("CMAKE_MANGLE_OBJECT_FILE_NAMES"))
{
......
Supports Markdown
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