summaryrefslogtreecommitdiff
path: root/Source/cmake.h
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2022-02-17 08:46:09 -0500
committerBrad King <brad.king@kitware.com>2022-02-17 16:54:30 -0500
commit7083b1949801dcab8b76cd3978261aca7be30c0e (patch)
treebc30fcc51660f49bca38b1cef47a1fa4d3c938f2 /Source/cmake.h
parent9c81f2cb8bcb5f4ad96f2ad527035649bd70d5fc (diff)
downloadcmake-7083b1949801dcab8b76cd3978261aca7be30c0e.tar.gz
cmake: When given multiple source paths use last instead of first
When given two source paths via `-S` or just directory paths prefer the last one. When the paths are mixed always prefer the last `-S` entry. Fixes: #23238
Diffstat (limited to 'Source/cmake.h')
-rw-r--r--Source/cmake.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmake.h b/Source/cmake.h
index 97444b8660..9c795c554b 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -183,6 +183,29 @@ public:
#endif
std::string ReportCapabilities() const;
+ enum class HomeDirArgStyle
+ {
+ Plain,
+ Dash_S,
+ };
+
+ /**
+ * Set the home directory from `-S` or from a known location
+ * that contains a CMakeLists.txt. Will generate warnings
+ * when overriding an existing source directory.
+ *
+ * | args | src dir| warning |
+ * | ----------------- | ------ | -------------- |
+ * | `dirA dirA` | dirA | N/A |
+ * | `-S dirA -S dirA` | dirA | N/A |
+ * | `-S dirA -S dirB` | dirB | Ignoring dirA |
+ * | `-S dirA dirB` | dirA | Ignoring dirB |
+ * | `dirA -S dirB` | dirB | Ignoring dirA |
+ * | `dirA dirB` | dirB | Ignoring dirA |
+ */
+ void SetHomeDirectoryViaCommandLine(std::string const& path,
+ HomeDirArgStyle argStyle);
+
//@{
/**
* Set/Get the home directory (or output directory) in the project. The