cmake: reset check state before testing -fobjc-arc (cherry picked from commit 517db6d887e41cc091e71e290ac7ee2382119dd7)