Fix non-matching endif in cmake. #3584