cmGeneratorTarget: only apply short object names when necessary

When there is no PCH extension, there is no source file necessary as the
source is not compiled at all.
This commit is contained in:
Ben Boeckel committed 2025-09-02 12:56:23 -04:00
1 parent b9a88d1211
commit b64226f2b4
1 file changed
+1 -1
+1 -1
View File
@@ -3183,7 +3183,7 @@ std::string cmGeneratorTarget::GetPchFile(std::string const& config,
pchFile = replaceExtension(pchFileObject, pchExtension);
}
} else {
if (this->GetUseShortObjectNames()) {
if (this->GetUseShortObjectNames() && !pchExtension.empty()) {
auto pchSource = this->GetPchSource(config, language, arch);
auto* pchSf = this->Makefile->GetOrCreateSource(
pchSource, false, cmSourceFileLocationKind::Known);