Needs endforeach() a lable with older cmake version?

Removing the arguments from endforeach() and endfunction() will not work with older versions of CMake, they were only made optional in CMake 3.14.

Is that true?

No, that was when the documentation was updated to make it explicitly clear that the argument is optional.

The argument became optional in CMake 2.6, and not having one is recommend best practise ( https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#isnt-the-expression-in-the-elseexpression-confusing )