cmOutputConverter: Always set relative path top source and binary together
Refactor to set both at once so we have a single place in the code that knows both have been set.
This commit is contained in:
parent
de766bc7e0
commit
43416c48ed
@ -2495,8 +2495,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
|
|||||||
snapshot.GetDirectory().SetCurrentBinary(dir_cur_bld);
|
snapshot.GetDirectory().SetCurrentBinary(dir_cur_bld);
|
||||||
auto mfd = cm::make_unique<cmMakefile>(this, snapshot);
|
auto mfd = cm::make_unique<cmMakefile>(this, snapshot);
|
||||||
auto lgd = this->CreateLocalGenerator(mfd.get());
|
auto lgd = this->CreateLocalGenerator(mfd.get());
|
||||||
lgd->SetRelativePathTopSource(dir_top_src);
|
lgd->SetRelativePathTop(dir_top_src, dir_top_bld);
|
||||||
lgd->SetRelativePathTopBinary(dir_top_bld);
|
|
||||||
this->Makefiles.push_back(std::move(mfd));
|
this->Makefiles.push_back(std::move(mfd));
|
||||||
this->LocalGenerators.push_back(std::move(lgd));
|
this->LocalGenerators.push_back(std::move(lgd));
|
||||||
}
|
}
|
||||||
|
@ -1508,13 +1508,12 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup relative path top directories.
|
// Setup relative path top directories.
|
||||||
if (cmValue relativePathTopSource =
|
cmValue relativePathTopSource =
|
||||||
mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) {
|
mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE");
|
||||||
this->SetRelativePathTopSource(*relativePathTopSource);
|
cmValue relativePathTopBinary =
|
||||||
}
|
mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY");
|
||||||
if (cmValue relativePathTopBinary =
|
if (relativePathTopSource && relativePathTopBinary) {
|
||||||
mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) {
|
this->SetRelativePathTop(*relativePathTopSource, *relativePathTopBinary);
|
||||||
this->SetRelativePathTopBinary(*relativePathTopBinary);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cmSystemTools::Error("Directory Information file not found");
|
cmSystemTools::Error("Directory Information file not found");
|
||||||
|
@ -79,14 +79,11 @@ std::string const& cmOutputConverter::GetRelativePathTopBinary() const
|
|||||||
return this->RelativePathTopBinary;
|
return this->RelativePathTopBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmOutputConverter::SetRelativePathTopSource(std::string const& top)
|
void cmOutputConverter::SetRelativePathTop(std::string const& topSource,
|
||||||
|
std::string const& topBinary)
|
||||||
{
|
{
|
||||||
this->RelativePathTopSource = top;
|
this->RelativePathTopSource = topSource;
|
||||||
}
|
this->RelativePathTopBinary = topBinary;
|
||||||
|
|
||||||
void cmOutputConverter::SetRelativePathTopBinary(std::string const& top)
|
|
||||||
{
|
|
||||||
this->RelativePathTopBinary = top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmOutputConverter::MaybeRelativeTo(
|
std::string cmOutputConverter::MaybeRelativeTo(
|
||||||
|
@ -29,8 +29,8 @@ public:
|
|||||||
|
|
||||||
std::string const& GetRelativePathTopSource() const;
|
std::string const& GetRelativePathTopSource() const;
|
||||||
std::string const& GetRelativePathTopBinary() const;
|
std::string const& GetRelativePathTopBinary() const;
|
||||||
void SetRelativePathTopSource(std::string const& top);
|
void SetRelativePathTop(std::string const& topSource,
|
||||||
void SetRelativePathTopBinary(std::string const& top);
|
std::string const& topBinary);
|
||||||
|
|
||||||
enum OutputFormat
|
enum OutputFormat
|
||||||
{
|
{
|
||||||
|
@ -1286,8 +1286,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
|
|||||||
// FIXME: With advanced add_subdirectory usage, these are
|
// FIXME: With advanced add_subdirectory usage, these are
|
||||||
// not necessarily the same as the generator originally used.
|
// not necessarily the same as the generator originally used.
|
||||||
// We should pass all these directories through an info file.
|
// We should pass all these directories through an info file.
|
||||||
lgd->SetRelativePathTopSource(homeDir);
|
lgd->SetRelativePathTop(homeDir, homeOutDir);
|
||||||
lgd->SetRelativePathTopBinary(homeOutDir);
|
|
||||||
|
|
||||||
// Actually scan dependencies.
|
// Actually scan dependencies.
|
||||||
return lgd->UpdateDependencies(depInfo, verbose, color) ? 0 : 2;
|
return lgd->UpdateDependencies(depInfo, verbose, color) ? 0 : 2;
|
||||||
@ -1569,8 +1568,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
|
|||||||
// FIXME: With advanced add_subdirectory usage, these are
|
// FIXME: With advanced add_subdirectory usage, these are
|
||||||
// not necessarily the same as the generator originally used.
|
// not necessarily the same as the generator originally used.
|
||||||
// We should pass all these directories through an info file.
|
// We should pass all these directories through an info file.
|
||||||
lgd->SetRelativePathTopSource(homeDir);
|
lgd->SetRelativePathTop(homeDir, homeOutDir);
|
||||||
lgd->SetRelativePathTopBinary(homeOutDir);
|
|
||||||
|
|
||||||
return cmTransformDepfile(format, *lgd, args[8], args[9]) ? 0 : 2;
|
return cmTransformDepfile(format, *lgd, args[8], args[9]) ? 0 : 2;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user