summaryrefslogtreecommitdiffstats
path: root/Source/cmExportCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-06-29 19:51:50 (GMT)
committerBrad King <brad.king@kitware.com>2022-07-05 20:47:01 (GMT)
commit298f226cb4f63610cd8a7a851c0867a41c5d422b (patch)
tree0efe91c65324e2dfecd35e8ef760170465294551 /Source/cmExportCommand.cxx
parent0a4c5164c93a9c1c8ef7a8191fc46ca80f643168 (diff)
downloadCMake-298f226cb4f63610cd8a7a851c0867a41c5d422b.zip
CMake-298f226cb4f63610cd8a7a851c0867a41c5d422b.tar.gz
CMake-298f226cb4f63610cd8a7a851c0867a41c5d422b.tar.bz2
cmExportCommand: Use cm::optional for keyword argument presence
Diffstat (limited to 'Source/cmExportCommand.cxx')
-rw-r--r--Source/cmExportCommand.cxx14
1 files changed, 5 insertions, 9 deletions
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 9a21a98..198874e 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -7,8 +7,7 @@
#include <utility>
#include <cm/memory>
-#include <cm/string_view>
-#include <cmext/algorithm>
+#include <cm/optional>
#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
@@ -58,7 +57,7 @@ bool cmExportCommand(std::vector<std::string> const& args,
struct Arguments
{
std::string ExportSetName;
- std::vector<std::string> Targets;
+ cm::optional<std::vector<std::string>> Targets;
std::string Namespace;
std::string Filename;
std::string AndroidMKFile;
@@ -80,9 +79,7 @@ bool cmExportCommand(std::vector<std::string> const& args,
}
std::vector<std::string> unknownArgs;
- std::vector<cm::string_view> keywordsMissingValue;
- Arguments const arguments =
- parser.Parse(args, &unknownArgs, &keywordsMissingValue);
+ Arguments const arguments = parser.Parse(args, &unknownArgs);
if (!unknownArgs.empty()) {
status.SetError("Unknown argument: \"" + unknownArgs.front() + "\".");
@@ -146,9 +143,8 @@ bool cmExportCommand(std::vector<std::string> const& args,
return false;
}
exportSet = &it->second;
- } else if (!arguments.Targets.empty() ||
- cm::contains(keywordsMissingValue, "TARGETS")) {
- for (std::string const& currentTarget : arguments.Targets) {
+ } else if (arguments.Targets) {
+ for (std::string const& currentTarget : *arguments.Targets) {
if (mf.IsAlias(currentTarget)) {
std::ostringstream e;
e << "given ALIAS target \"" << currentTarget