You can define a ZLIB_ROOT cmake/env variable pointing to homebrew's zlib prefix:
ZLIB_ROOT
export ZLIB_ROOT=/opt/homebrew/Cellar/zlib/1.3.1/ cmake