1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

shortobj: properly force long names when computing long names

The arguments need to be able to force a long name computation so that
install paths can use the intended long paths. Use this computed state
rather than asking the generator for its base state.

Also force long paths for Visual Studio generators when computing it.

Fixes: #27233
This commit is contained in:
Ben Boeckel
2025-09-17 14:36:29 -04:00
parent 1980e47192
commit b2ebfd7709
2 changed files with 3 additions and 2 deletions

View File

@@ -4507,7 +4507,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
}
// Strip source file extension when shortening object file paths
if (this->UseShortObjectNames()) {
if (useShortObjectNames) {
objectName = cmSystemTools::GetFilenameWithoutExtension(objectName);
}
// Store the new extension.

View File

@@ -99,8 +99,9 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
if (counts[cmSystemTools::LowerCase(longObjectName)] > 1) {
const_cast<cmGeneratorTarget*>(gt)->AddExplicitObjectName(sf);
bool keptSourceExtension;
bool forceShortObjectName = false;
longObjectName = this->GetObjectFileNameWithoutTarget(
*sf, dir_max, &keptSourceExtension, custom_ext);
*sf, dir_max, &keptSourceExtension, custom_ext, &forceShortObjectName);
}
si.second.ShortLoc.emplace(shortObjectName);
si.second.LongLoc.Update(longObjectName);