cmake: Allow CMAKE_BUILD_TYPE to be set by environment variable

When no `CMAKE_BUILD_TYPE` is explicitly specified while creating a new
build tree, check for an environment variable of the same name.

Issue: #20983
10 files changed