core: fix detection of iconv with cmake on OS X (bug #38321)