mirror of
https://github.com/reactos/CMake.git
synced 2025-02-08 04:48:46 +00:00
list(POP_FRONT): Fix always assigning first item to output vars
Fixes: #19436
This commit is contained in:
parent
753373579e
commit
822abf1265
@ -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...
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user