An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit 43ffd2c3 authored by Cristian Adam's avatar Cristian Adam 💬
Browse files

Unity: No repeated path for internal generated unity files

Fixes: #20002
parent 602f2118
Pipeline #152422 passed with stage
......@@ -3148,6 +3148,22 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
}
}
// Ensure that for the CMakeFiles/<target>.dir/generated_source_file
// we don't end up having:
// CMakeFiles/<target>.dir/CMakeFiles/<target>.dir/generated_source_file.obj
const char* unitySourceFile = source.GetProperty("UNITY_SOURCE_FILE");
const char* pchExtension = source.GetProperty("PCH_EXTENSION");
if (unitySourceFile || pchExtension) {
if (pchExtension) {
customOutputExtension = pchExtension;
}
cmsys::RegularExpression var("(CMakeFiles/[^/]+.dir/)");
if (var.find(objectName)) {
objectName.erase(var.start(), var.end() - var.start());
}
}
// Replace the original source file extension with the object file
// extension.
bool keptSourceExtension = true;
......@@ -3164,19 +3180,6 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
}
}
const char* pchExtension = source.GetProperty("PCH_EXTENSION");
if (pchExtension) {
customOutputExtension = pchExtension;
// Make sure that for the CMakeFiles/<target>.dir/cmake_pch.h|xx.c|xx
// source file, we don't end up having
// CMakeFiles/<target>.dir/CMakeFiles/<target>.dir/cmake_pch.h|xx.pch
cmsys::RegularExpression var("(CMakeFiles/[^/]+.dir/)");
while (var.find(objectName)) {
objectName.erase(var.start(), var.end() - var.start());
}
}
// Remove the source extension if it is to be replaced.
if (replaceExt || customOutputExtension) {
keptSourceExtension = false;
......
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