diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 05f80b070c..badb3ee955 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -92,7 +92,7 @@ std::string cmLocalCommonGenerator::GetTargetFortranFlags( std::string cmLocalCommonGenerator::GetTargetDirectory( cmGeneratorTarget const* target) const { - std::string dir = cmStrCat("CMakeFiles/", target->GetName()); + std::string dir = target->GetName(); #if defined(__VMS) dir += "_dir"; #else diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 46126540df..db3580ff42 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -4288,7 +4288,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( std::string cmLocalGenerator::GetObjectOutputRoot() const { - return this->GetCurrentBinaryDirectory(); + return cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles"); } std::string cmLocalGenerator::GetSourceFileLanguage(cmSourceFile const& source) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e7a8f62b9a..609f46e03f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1150,11 +1150,13 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand( std::set 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 */ diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 381e914166..db7b8ef49a 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -84,6 +84,11 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames( } } +std::string cmLocalVisualStudioGenerator::GetObjectOutputRoot() const +{ + return this->GetCurrentBinaryDirectory(); +} + std::unique_ptr cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target, std::string const& config, diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 7303f92a06..5630d119c5 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -51,6 +51,8 @@ public: std::map& mapping, cmGeneratorTarget const* = nullptr) override; + std::string GetObjectOutputRoot() const override; + protected: virtual char const* ReportErrorLabel() const; virtual bool CustomCommandUseLocal() const { return false; } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 79e017509b..d73fc7259f 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -462,6 +462,9 @@ bool cmQtAutoGenInitializer::InitCustomTargets() std::string(), this->Makefile->GetCurrentBinaryDirectory()); // Info directory + // TODO: Split this? `AutogenInfo.json` is expected to always be under the + // `CMakeFiles` directory, but not all generators places its `.dir` + // directories there. this->Dir.Info = cmStrCat(cbd, "/CMakeFiles/", this->GenTarget->GetName(), "_autogen.dir"); cmSystemTools::ConvertToUnixSlashes(this->Dir.Info);