file(GENERATE): Restore INPUT|CONTENT parse checking
Refactoring in !7450 (merged) accidentally broke the check that the input argument is either INPUT
or CONTENT
.
The check is supposed to fail when arguments are passed in the wrong order. For example:
file(GENERATE OUTPUT ...
TARGET <target>
CONTENT <content>)
Prior to this fix, the input method would be CONTENT, but because the
first parsed keyword is not CONTENT
, inputIsContent
would be false.
The first parsed keyword isn't INPUT either, so we would not continue
into the error condition. CMake would then try to handle this as an
input file, when there isn't one, resulting in uninitialized memory
usage and segfaults or corruption later on.
Fixes: #25169 (closed)
Backport: release
Topic-rename: file-GENERATE-arg-parsing
Edited by Brad King