diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2018-10-11 21:23:12 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2018-10-16 18:31:39 (GMT) |
commit | acfe53c58817c662b935fbe0f0443de298371731 (patch) | |
tree | 7b2e3dcee64622cbc0f2d514cd0b2727c0ddbc0d /Source | |
parent | bf572ac952d7ddf2b7208efc56f104844aea72e2 (diff) | |
download | CMake-acfe53c58817c662b935fbe0f0443de298371731.zip CMake-acfe53c58817c662b935fbe0f0443de298371731.tar.gz CMake-acfe53c58817c662b935fbe0f0443de298371731.tar.bz2 |
cmListCommand: make list(ACTION not_a_list) succeed when idempotent
The operations changed here all are no-ops on empty lists anyways, so
just have them succeed when given non-extant lists.
- `list(REMOVE_ITEM)`
- `list(REMOVE_DUPLICATES)`
- `list(SORT)`
- `list(FILTER)`
- `list(REVERSE)`
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmListCommand.cxx | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index b9c7ada..b46eb6d 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -346,8 +346,7 @@ bool cmListCommand::HandleRemoveItemCommand( // expand the variable std::vector<std::string> varArgsExpanded; if (!this->GetList(varArgsExpanded, listName)) { - this->SetError("sub-command REMOVE_ITEM requires list to be present."); - return false; + return true; } std::vector<std::string> remove(args.begin() + 2, args.end()); @@ -376,8 +375,7 @@ bool cmListCommand::HandleReverseCommand(std::vector<std::string> const& args) // expand the variable std::vector<std::string> varArgsExpanded; if (!this->GetList(varArgsExpanded, listName)) { - this->SetError("sub-command REVERSE requires list to be present."); - return false; + return true; } std::string value = cmJoin(cmReverseRange(varArgsExpanded), ";"); @@ -399,9 +397,7 @@ bool cmListCommand::HandleRemoveDuplicatesCommand( // expand the variable std::vector<std::string> varArgsExpanded; if (!this->GetList(varArgsExpanded, listName)) { - this->SetError( - "sub-command REMOVE_DUPLICATES requires list to be present."); - return false; + return true; } std::vector<std::string>::const_iterator argsEnd = @@ -1152,8 +1148,7 @@ bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args) // expand the variable std::vector<std::string> varArgsExpanded; if (!this->GetList(varArgsExpanded, listName)) { - this->SetError("sub-command SORT requires list to be present."); - return false; + return true; } if ((sortCompare == cmStringSorter::Compare::STRING) && @@ -1304,8 +1299,7 @@ bool cmListCommand::HandleFilterCommand(std::vector<std::string> const& args) // expand the variable std::vector<std::string> varArgsExpanded; if (!this->GetList(varArgsExpanded, listName)) { - this->SetError("sub-command FILTER requires list to be present."); - return false; + return true; } const std::string& mode = args[3]; |