summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-06-26 11:00:14 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-06-26 11:03:25 (GMT)
commit30eee7702f5fdd331fec80539b6c33ba36652aaa (patch)
tree6c7455cce718e92789b2d44ba45daa51ad0aa102
parentc86476549653f9915a4b9f4cc32d3e569f959d38 (diff)
parent2ba5c37b3fed00ecc307b1d93780acd4a57695eb (diff)
downloadCMake-30eee7702f5fdd331fec80539b6c33ba36652aaa.zip
CMake-30eee7702f5fdd331fec80539b6c33ba36652aaa.tar.gz
CMake-30eee7702f5fdd331fec80539b6c33ba36652aaa.tar.bz2
Merge topic 'export-targets-empty'
2ba5c37b3f export: Restore support for empty TARGETS list Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3484
-rw-r--r--Source/cmExportCommand.cxx11
-rw-r--r--Tests/RunCMake/export/Empty.cmake1
-rw-r--r--Tests/RunCMake/export/RunCMakeTest.cmake1
3 files changed, 11 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;
diff --git a/Tests/RunCMake/export/Empty.cmake b/Tests/RunCMake/export/Empty.cmake
new file mode 100644
index 0000000..2198ddf
--- /dev/null
+++ b/Tests/RunCMake/export/Empty.cmake
@@ -0,0 +1 @@
+export(TARGETS FILE targets.cmake)
diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake
index 46bb1fc..97a0ca6 100644
--- a/Tests/RunCMake/export/RunCMakeTest.cmake
+++ b/Tests/RunCMake/export/RunCMakeTest.cmake
@@ -1,6 +1,7 @@
include(RunCMake)
run_cmake(CustomTarget)
+run_cmake(Empty)
run_cmake(TargetNotFound)
run_cmake(AppendExport)
run_cmake(OldIface)