Shouldn't this check for `CMAKE_BUILD_TYPE` being already defined, as defining it on cmdline should override any env settings?