From what I recall, CMake does not short-circuit the expression in an if() command. So if you have if(expr1 AND expr2), and expr1 is false, it will still evaluate expr2. If you were trying to use CMAKE_HOST_WIN32 to prevent evaluation of $ENV{ProgramFiles}, that’s not going to work as a single expression. You would have to write it as two separate commands:
I’m pretty sure it does short circuit the predicate evaluations. What is not short-circuited is the variable evaluations literally present in the argument list. So $ENV{ProgramFiles} is evaluated (which is what fires the warning), but the STREQUAL is not.