cmake: fix a bug that compiler flag checks are skipped

GitHub: fixes #21