Abort and core dump caused when passing a non-integer to `foreach(RANGE)`
Passing a non-integer argument to to foreach(RANGE)
throws an exception when parsing that isn't caught and causes an abort()
rather than CMake issuing an error message and failing "gracefully".
# foo.cmake
set(bar 3)
foreach(foo RANGE bar)
endforeach()
Clearly there's a typo here in that bar
should be dereferenced via foreach(foo RANGE ${bar})
. However, I'd still expect CMake to issue some sort of parsing error instead of aborting from an uncaught exception:
$ cmake -P foo.cmake
terminate called after throwing an instance of 'std::invalid_argument'
what(): stoi
Aborted (core dumped)