From 7083b1949801dcab8b76cd3978261aca7be30c0e Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 17 Feb 2022 08:46:09 -0500 Subject: 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 --- Source/cmake.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Source/cmake.h') 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 -- cgit v1.2.1