Unable to build HDF5-1.8.16 with external zlib on Windows

I have been running into problems while trying to build HDF5-1.8.16 (as a shared lib) with external zlib, on Windows. I already have zlib.lib and header files of zlib; I intend to use that library while building HDF5. I've tried providing these option to cmake : HDF5_ENABLE_Z_LIB_SUPPORT, ZLIB_INCLUDE_DIR and ZLIB_LIBRARY - it doesn't help. cmake is able to find the library and executes the configure stage without failure, but when I build, I see a flurry of linker errors - all unresolved symbols are zlib specific. How could I go about building HDF5?