Set linker flags in Cmakelists?

There seems to be a bug in cocos2d-x 4 and Xcode 12.5

The linker flags last two lines say:

/usr/lib/libz.dylib
/usr/lib/libiconv.dylib

This will result in an error:

clang: error: no such file or directory: '/usr/lib/libz.dylib'

clang: error: no such file or directory: '/usr/lib/libiconv.dylib'

To resolve this, I delete those two lines, and add the flags -lz and -liconv

This makes it compile. But every time I run:
cmake ../.. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos

to regenerate the XcodeProj file, I need to update the flags again. This is tedious. Is there a way to fix this, such as specifying something in cmakelists ?

It has been discussed before:

https://discuss.cocos2d-x.org/t/xcode-12-2-errors-when-ios-simulator-with-cocos2d-x-4-0/52203/22