cmake: use find_program(REQUIRED) to fail early on missing programs
Since upgrading minimum CMake version to 3.22.1 (commit
469d82a1), we can
now use find_program(REQUIRED) which was introduced in CMake 3.18.
This change replaces manual FATAL_ERROR checks with the REQUIRED option
and adds it to programs that are actually needed during the build. This
ensures the build fails early during configuration rather than later
during compilation when missing programs are invoked.
Changes:
- Replace find_program() + message(FATAL_ERROR) patterns with REQUIRED
- Add REQUIRED to programs that are used during build but previously
had no error checking
Reference: https://cmake.org/cmake/help/latest/command/find_program.html
Signed-off-by: Kefu Chai <tchaikov@gmail.com>