cmake: reset output variable before checking