summaryrefslogtreecommitdiff
path: root/Source/cmConfigureFileCommand.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2020-04-08 13:10:45 -0400
committerBen Boeckel <ben.boeckel@kitware.com>2020-04-13 11:26:03 -0400
commit7cb72fadc8f78945fce75d23f9a4cd6ce0e92e72 (patch)
tree992dd339e90991b1f826a17180d432ac43f87d04 /Source/cmConfigureFileCommand.cxx
parentf413727d27be474dc2b943b434ea12c357f65473 (diff)
downloadcmake-7cb72fadc8f78945fce75d23f9a4cd6ce0e92e72.tar.gz
cmConfigureFileCommand: simplify no-op argument handling
Diffstat (limited to 'Source/cmConfigureFileCommand.cxx')
-rw-r--r--Source/cmConfigureFileCommand.cxx26
1 files changed, 20 insertions, 6 deletions
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index 8767386cff..bac9337617 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -2,6 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmConfigureFileCommand.h"
+#include <set>
+
+#include <cm/string_view>
+
+#include "cm_static_string_view.hxx"
+
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -56,6 +62,18 @@ bool cmConfigureFileCommand(std::vector<std::string> const& args,
bool copyOnly = false;
bool escapeQuotes = false;
+ static std::set<cm::string_view> noopOptions = {
+ /* Legacy. */
+ "IMMEDIATE"_s,
+ /* Handled by NewLineStyle member. */
+ "NEWLINE_STYLE"_s,
+ "LF"_s,
+ "UNIX"_s,
+ "CRLF"_s,
+ "WIN32"_s,
+ "DOS"_s,
+ };
+
std::string unknown_args;
bool atOnly = false;
for (unsigned int i = 2; i < args.size(); ++i) {
@@ -70,12 +88,8 @@ bool cmConfigureFileCommand(std::vector<std::string> const& args,
escapeQuotes = true;
} else if (args[i] == "@ONLY") {
atOnly = true;
- } else if (args[i] == "IMMEDIATE") {
- /* Ignore legacy option. */
- } else if (args[i] == "NEWLINE_STYLE" || args[i] == "LF" ||
- args[i] == "UNIX" || args[i] == "CRLF" || args[i] == "WIN32" ||
- args[i] == "DOS") {
- /* Options handled by NewLineStyle member above. */
+ } else if (noopOptions.find(args[i]) != noopOptions.end()) {
+ /* Ignore no-op options. */
} else {
unknown_args += " ";
unknown_args += args[i];