cmLocalGenerator: move the CMakeFiles subdir from the target to output root

When target directories are shortened, the `CMakeFiles` path component
will be part of the root, not the target directory. Since other files
end up constructing paths manually, move the differing component into
the correct logical path construction part.
This commit is contained in:
Ben Boeckel
2025-05-21 21:09:08 +02:00
parent bc19e42461
commit 35d32b8741
6 changed files with 15 additions and 3 deletions
+3 -1
View File
@@ -1150,11 +1150,13 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
std::set<std::string> languages;
target->GetLanguages(
languages, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
auto langFileDir = cmSystemTools::GetFilenamePath(
this->MaybeRelativeToCurBinDir(cleanfile));
/* clang-format off */
fout << "\n"
"# Per-language clean rules from dependency scanning.\n"
"foreach(lang " << cmJoin(languages, " ") << ")\n"
" include(" << this->GetTargetDirectory(target)
" include(" << langFileDir
<< "/cmake_clean_${lang}.cmake OPTIONAL)\n"
"endforeach()\n";
/* clang-format on */