Fixed scoping of cmake variable.