diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-02-17 13:46:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-02-17 21:54:30 (GMT) |
commit | 7083b1949801dcab8b76cd3978261aca7be30c0e (patch) | |
tree | bc30fcc51660f49bca38b1cef47a1fa4d3c938f2 /Source/cmake.h | |
parent | 9c81f2cb8bcb5f4ad96f2ad527035649bd70d5fc (diff) | |
download | CMake-7083b1949801dcab8b76cd3978261aca7be30c0e.zip CMake-7083b1949801dcab8b76cd3978261aca7be30c0e.tar.gz CMake-7083b1949801dcab8b76cd3978261aca7be30c0e.tar.bz2 |
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.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmake.h b/Source/cmake.h index 97444b8..9c795c5 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 |