cmLocalGeneratorShortenObjectName will not work for file-names longer than 32 characters
We've had a strange bug where in one project building with long paths would work and in the other project it didn't. We found that in the working project, the files compiled from an external source would be like relative/path/to/CurrentList/1234hash/externalSource.c. In the broken project it would look like relative/path/to/CurrentList/C_/path/to/external/Source/with/all/sub/folders/and/then/some/external_Module_with_lots_of_informations.c
I think I found the reason in cmLocalGenerator.cxx:
static bool cmLocalGeneratorShortenObjectName(std::string& objName,
std::string::size_type max_len)
{
// Replace the beginning of the path portion of the object name with
// its own md5 sum.
std::string::size_type pos =
objName.find('/', objName.size() - max_len + 32);
If I understand this correctly, this will only do any hash-replacement if the last '/' is less than 32-characters from the end.
Can we replace that with this? (at least with my change I'm getting a different error now that seems more fixable)
#if defined(CM_LG_ENCODE_OBJECT_NAMES)
static bool cmLocalGeneratorShortenObjectName(std::string& objName,
std::string::size_type max_len)
{
// Replace the beginning of the path portion of the object name with
// its own md5 sum.
std::string::size_type pos =
objName.find_last_of('/');