Updated CMake if statements in line with CMake v3.1 policy.