summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-12 19:34:38 (GMT)
committerBrad King <brad.king@kitware.com>2021-05-13 16:47:25 (GMT)
commit1879f1bcbc4e2fbd9eaca4eff351ab928c4a3268 (patch)
treef8898282e05c75044de5a98937a7eb51b0811ecf
parent1d1d88d3c8b6745b31c220599f536fd50bf5cbe9 (diff)
downloadCMake-1879f1bcbc4e2fbd9eaca4eff351ab928c4a3268.zip
CMake-1879f1bcbc4e2fbd9eaca4eff351ab928c4a3268.tar.gz
CMake-1879f1bcbc4e2fbd9eaca4eff351ab928c4a3268.tar.bz2
cmLocalCommonGenerator: Factor out relative path conversion helper
-rw-r--r--Source/cmCommonTargetGenerator.cxx3
-rw-r--r--Source/cmLocalCommonGenerator.cxx9
-rw-r--r--Source/cmLocalCommonGenerator.h2
3 files changed, 10 insertions, 4 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 228cff7..0c5a7df 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -241,8 +241,7 @@ std::string cmCommonTargetGenerator::GetManifests(const std::string& config)
manifests.reserve(manifest_srcs.size());
for (cmSourceFile const* manifest_src : manifest_srcs) {
manifests.push_back(this->LocalCommonGenerator->ConvertToOutputFormat(
- this->LocalCommonGenerator->MaybeConvertToRelativePath(
- this->LocalCommonGenerator->GetWorkingDirectory(),
+ this->LocalCommonGenerator->MaybeRelativeToWorkDir(
manifest_src->GetFullPath()),
cmOutputConverter::SHELL));
}
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 5daaeff..4ec0c9d 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -24,6 +24,12 @@ cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
cmLocalCommonGenerator::~cmLocalCommonGenerator() = default;
+std::string cmLocalCommonGenerator::MaybeRelativeToWorkDir(
+ std::string const& path) const
+{
+ return this->MaybeConvertToRelativePath(this->WorkingDirectory, path);
+}
+
std::string cmLocalCommonGenerator::GetTargetFortranFlags(
cmGeneratorTarget const* target, std::string const& config)
{
@@ -38,8 +44,7 @@ std::string cmLocalCommonGenerator::GetTargetFortranFlags(
target->GetFortranModuleDirectory(this->WorkingDirectory);
if (!mod_dir.empty()) {
mod_dir = this->ConvertToOutputFormat(
- this->MaybeConvertToRelativePath(this->WorkingDirectory, mod_dir),
- cmOutputConverter::SHELL);
+ this->MaybeRelativeToWorkDir(mod_dir), cmOutputConverter::SHELL);
} else {
mod_dir =
this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index f1eaf61..72c8e83 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -32,6 +32,8 @@ public:
std::string GetWorkingDirectory() const { return this->WorkingDirectory; }
+ std::string MaybeRelativeToWorkDir(std::string const& path) const;
+
std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
std::string const& config) override;