string(JSON) with no ERROR_VARIABLE does not exit with a fatal error if an error occurs, but docs seem to indicate that it should (ambiguous)
The current latest docs (3.27) state (emphasis added):
Note In each of the following JSON-related subcommands, if the optional
ERROR_VARIABLE
argument is given, errors will be reported in<error-variable>
and the<out-var>
will be set to<member|index>-[<member|index>...]-NOTFOUND
with the path elements up to the point where the error occurred, or justNOTFOUND
if there is no relevant path. If an error occurs but theERROR_VARIABLE
option is not present, a fatal error message is generated. If no error occurs, the<error-variable>
will be set toNOTFOUND
.
That seems to (ambiguously) imply that CMake will exit with a fatal error as well, since message(FATAL_ERROR ...)
causes CMake to stop processing and generation.
I raised this on the Discourse site and @ben.boeckel replied:
That sounds like an oversight to me. Could you please file an issue.
What should the correct behaviour be? Also, could the documentation for the string(JSON ...)
commands please be clarified with respect to this?
Another related-sounding Discourse thread: Fatal errors not halting processing