summaryrefslogtreecommitdiff
path: root/Source/cmLocalGenerator.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-12 15:51:47 -0400
committerBrad King <brad.king@kitware.com>2021-05-13 12:47:25 -0400
commit15fa3200715869d5acb94a282feb301d2e10a0eb (patch)
tree9c5d6c18b03b2917cc54d7fa2cfa5b9c89d8e4b0 /Source/cmLocalGenerator.h
parent1879f1bcbc4e2fbd9eaca4eff351ab928c4a3268 (diff)
downloadcmake-15fa3200715869d5acb94a282feb301d2e10a0eb.tar.gz
cmLocalGenerator: Factor out relative path conversion helpers
Most calls to `MaybeConvertToRelativePath` use one of our common work directories (e.g. top of the build tree) as the local path. Add helpers for each of the common cases to simplify and clarify call sites.
Diffstat (limited to 'Source/cmLocalGenerator.h')
-rw-r--r--Source/cmLocalGenerator.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index f59712055b..5ebf70c85f 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -464,13 +464,14 @@ public:
/**
* Convert the given remote path to a relative path with respect to
- * the given local path. Both paths must use forward slashes and not
- * already be escaped or quoted.
+ * one of our common work directories. The path must use forward
+ * slashes and not already be escaped or quoted.
* The conversion is skipped if the paths are not both in the source
* or both in the binary tree.
*/
- std::string MaybeConvertToRelativePath(std::string const& local_path,
- std::string const& remote_path) const;
+ std::string MaybeRelativeToTopBinDir(std::string const& path) const;
+ std::string MaybeRelativeToCurBinDir(std::string const& path) const;
+ std::string MaybeRelativeToCurSrcDir(std::string const& path) const;
/**
* Generate a macOS application bundle Info.plist file.
@@ -558,6 +559,9 @@ public:
cmProp GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop);
protected:
+ std::string MaybeRelativeTo(std::string const& local_path,
+ std::string const& remote_path) const;
+
// The default implementation ignores the IncludePathStyle and always
// uses absolute paths. A generator may override this to use relative
// paths in some cases.