When trying to build cocos2d-x v4 based project, I get the following error:
clang: error: no such file or directory: '/usr/lib/libz.dylib'
clang: error: no such file or directory: '/usr/lib/libiconv.dylib'
Command Ld failed with a nonzero exit code
This can be fixed by adding the following to other linker flags:
-lz
-liconv
The problem is, that the XcodeProj file is autogenerated by cmake, so each time I generate the XcodeProj file using cmake, I need to manually add the above two lines to each of the "Other Linker Flags" settings....
Is there a way to do this automatically using CMake ?
I have looked at:
https://discuss.cocos2d-x.org/t/xcode-12-2-errors-when-ios-simulator-with-cocos2d-x-4-0/52203/4
https://github.com/cocos2d/cocos2d-x/issues/20608
In the first link, right at the end of the page R101 suggests adding that to the APPLE section in my CMakeLists.txt. I have done that, but it still will not build. What am I missing ? It is very tedious having to add -lz, -liconv flags manually each time.