Merge branch 'bug/19436' into release-3.15

Merge-request: !3497
This commit is contained in:
Craig Scott
2019-07-01 21:49:18 +10:00
2 changed files with 14 additions and 1 deletions

View File

@@ -344,7 +344,7 @@ bool cmListCommand::HandlePopFrontCommand(std::vector<std::string> const& args)
auto vi = varArgsExpanded.begin();
for (; vi != varArgsExpanded.end() && ai != args.cend(); ++ai, ++vi) {
assert(!ai->empty());
this->Makefile->AddDefinition(*ai, varArgsExpanded.front().c_str());
this->Makefile->AddDefinition(*ai, vi->c_str());
}
varArgsExpanded.erase(varArgsExpanded.begin(), vi);
// Undefine the rest variables if the list gets empty earlier...

View File

@@ -77,3 +77,16 @@ endif()
if(NOT test STREQUAL "two")
message(FATAL_ERROR "`test` has unexpected value `${test}`")
endif()
# BUG 19436
set(myList a b c)
list(POP_FRONT myList first second)
if(NOT first STREQUAL "a")
message(FATAL_ERROR "BUG#19436: `first` has unexpected value `${first}`")
endif()
if(NOT second STREQUAL "b")
message(FATAL_ERROR "BUG#19436: `second` has unexpected value `${second}`")
endif()
if(NOT myList STREQUAL "c")
message(FATAL_ERROR "BUG#19436: `myList` has unexpected value `${myList}`")
endif()