summaryrefslogtreecommitdiffstats
path: root/Source/cmExportCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-06-25 18:37:38 (GMT)
committerBrad King <brad.king@kitware.com>2019-06-25 21:23:34 (GMT)
commit2ba5c37b3fed00ecc307b1d93780acd4a57695eb (patch)
tree9e2f2562b8c4bb12d1af62488934d293aac5eab8 /Source/cmExportCommand.cxx
parent5c7880956f9b3daea561c7bf817b27aa47b53dd0 (diff)
downloadCMake-2ba5c37b3fed00ecc307b1d93780acd4a57695eb.zip
CMake-2ba5c37b3fed00ecc307b1d93780acd4a57695eb.tar.gz
CMake-2ba5c37b3fed00ecc307b1d93780acd4a57695eb.tar.bz2
export: Restore support for empty TARGETS list
Refactoring in commit f5acecaa6f (cmExportCommand: Port to cmArgumentParser, 2019-03-23, v3.15.0-rc1~270^2~3) broke the `export` command's support for specifying `TARGETS` with no entries. Fix it and add a test case. Fixes: #19415
Diffstat (limited to 'Source/cmExportCommand.cxx')
-rw-r--r--Source/cmExportCommand.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 5b611c0..a849aa2 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -4,6 +4,8 @@
#include "cm_static_string_view.hxx"
#include "cmsys/RegularExpression.hxx"
+
+#include <algorithm>
#include <map>
#include <sstream>
#include <utility>
@@ -66,7 +68,9 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args,
}
std::vector<std::string> unknownArgs;
- Arguments const arguments = parser.Parse(args, &unknownArgs);
+ std::vector<std::string> keywordsMissingValue;
+ Arguments const arguments =
+ parser.Parse(args, &unknownArgs, &keywordsMissingValue);
if (!unknownArgs.empty()) {
this->SetError("Unknown argument: \"" + unknownArgs.front() + "\".");
@@ -128,7 +132,10 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
ExportSet = it->second;
- } else if (!arguments.Targets.empty()) {
+ } else if (!arguments.Targets.empty() ||
+ std::find(keywordsMissingValue.begin(),
+ keywordsMissingValue.end(),
+ "TARGETS") != keywordsMissingValue.end()) {
for (std::string const& currentTarget : arguments.Targets) {
if (this->Makefile->IsAlias(currentTarget)) {
std::ostringstream e;