cmake: remove needless "${" and "}"

We should not use "${" and "}" in if() for checking whether the
variable has valid value.