mirror of https://github.com/Kitware/CMake.git
Browse Source
cmake_parse_arguments: Restore capture of value after repeated keyword
cmake_parse_arguments: Restore capture of value after repeated keyword
When a single-value keyword is repeated, and the first instance is
missing a value, it prevents the value from the second instance from
being stored in a variable. This was a regression introduced by
commit ceeea4e511
(cmake_parse_arguments: Set variable if empty string
given after keyword, 2024-08-18). That change also didn't create a
variable if the keyword was given but without a value. The purpose
of the change was to always define a variable if a keyword was given.
Lastly, that change didn't protect the CMP0174 logic to make it only
apply to the PARSE_ARGV form.
The first two of the above problems are fixed here by tracking the
keywords given instead of checking which keywords were missing
values. The third problem is also fixed here, being tightly coupled
to the same logic as the first two problems.
Fixes: #26397
pull/375/head

committed by
Brad King

4 changed files with 75 additions and 39 deletions
-
24Help/policy/CMP0174.rst
-
54Source/cmParseArgumentsCommand.cxx
-
2Tests/RunCMake/cmake_parse_arguments/CornerCasesArgvN-stderr.txt
-
34Tests/RunCMake/cmake_parse_arguments/CornerCasesArgvN.cmake
Write
Preview
Loading…
Cancel
Save
Reference in new issue