diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2023-03-02 19:57:17 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2023-03-02 20:10:53 (GMT) |
commit | df38eaab2c806d15a3b2039bf96ad3e69569b5e8 (patch) | |
tree | a42128730d8dc88d90721cf88b9c5f25852b3cc4 /Source | |
parent | 9f309e655fe87b8d2193c8e719a8748ad3e3c382 (diff) | |
download | CMake-df38eaab2c806d15a3b2039bf96ad3e69569b5e8.zip CMake-df38eaab2c806d15a3b2039bf96ad3e69569b5e8.tar.gz CMake-df38eaab2c806d15a3b2039bf96ad3e69569b5e8.tar.bz2 |
Ninja Multi-Config: Write output path prefix
Fixes: #24566
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index ba7d7a7..d29c086 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -571,6 +571,7 @@ void cmGlobalNinjaGenerator::Generate() msg.str()); return; } + this->InitOutputPathPrefix(); if (!this->OpenBuildFileStreams()) { return; } @@ -582,7 +583,6 @@ void cmGlobalNinjaGenerator::Generate() it.second.TargetDependsClosureLocalOutputs.clear(); } - this->InitOutputPathPrefix(); this->TargetAll = this->NinjaOutputPath("all"); this->CMakeCacheFile = this->NinjaOutputPath("CMakeCache.txt"); this->DiagnosedCxxModuleNinjaSupport = false; @@ -2079,9 +2079,10 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) build.Outputs.front() = this->BuildAlias( this->NinjaOutputPath(this->GetCleanTargetName()), config); if (this->IsMultiConfig()) { - build.Variables["TARGETS"] = - cmStrCat(this->BuildAlias(GetByproductsForCleanTargetName(), config), - " ", GetByproductsForCleanTargetName()); + build.Variables["TARGETS"] = cmStrCat( + this->BuildAlias( + this->NinjaOutputPath(GetByproductsForCleanTargetName()), config), + " ", this->NinjaOutputPath(GetByproductsForCleanTargetName())); } build.ExplicitDeps.clear(); if (additionalFiles) { @@ -2096,7 +2097,8 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) if (this->IsMultiConfig()) { build.Variables["FILE_ARG"] = cmStrCat( "-f ", - cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(fileConfig)); + this->NinjaOutputPath( + cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(fileConfig))); } this->WriteBuild(*this->GetImplFileStream(fileConfig), build); } @@ -2118,8 +2120,8 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) std::vector<std::string> byproducts; byproducts.reserve(this->CrossConfigs.size()); for (auto const& config : this->CrossConfigs) { - byproducts.push_back( - this->BuildAlias(GetByproductsForCleanTargetName(), config)); + byproducts.push_back(this->BuildAlias( + this->NinjaOutputPath(GetByproductsForCleanTargetName()), config)); } byproducts.emplace_back(GetByproductsForCleanTargetName()); build.Variables["TARGETS"] = cmJoin(byproducts, " "); @@ -2127,7 +2129,8 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) for (auto const& fileConfig : configs) { build.Variables["FILE_ARG"] = cmStrCat( "-f ", - cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(fileConfig)); + this->NinjaOutputPath( + cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(fileConfig))); this->WriteBuild(*this->GetImplFileStream(fileConfig), build); } } @@ -2910,7 +2913,8 @@ bool cmGlobalNinjaMultiGenerator::OpenBuildFileStreams() *this->DefaultFileStream << "# Build using rules for '" << this->DefaultFileConfig << "'.\n\n" << "include " - << GetNinjaImplFilename(this->DefaultFileConfig) + << this->NinjaOutputPath( + GetNinjaImplFilename(this->DefaultFileConfig)) << "\n\n"; // Write a comment about this file. @@ -2943,7 +2947,8 @@ bool cmGlobalNinjaMultiGenerator::OpenBuildFileStreams() *this->ConfigFileStreams[config] << "# This file contains aliases specific to the \"" << config << "\"\n# configuration.\n\n" - << "include " << GetNinjaImplFilename(config) << "\n\n"; + << "include " << this->NinjaOutputPath(GetNinjaImplFilename(config)) + << "\n\n"; return true; }); |