[cmake] Using different variables to detect parent scope