Disable ZLIB from opencv 4.9

Hi all,
I am trying to build Zlib from OpenCV 4.9 source. I have disabled zlib in cmake file by using (-D BUILD_ZLIB:BOOL=0^) but it is always building. Does anyone have any idea about this?

Best Regards

delete cmakecache.txt ?

May be I’m wrong but BUILD_ZLIB:BOOL=OFF may be mean don’t build third party but use zlib already installed

zlib is still building even if cleaning the cache. Yes, I have Zlib in my repository but somehow it not using this and building Zlib again from a third party.

you have to define ZLIB_INCLUDE_DIR. For windows I use

-DZLIB_INCLUDE_DIR:PATH=${installRepo}/zlib/include -DZLIB_LIBRARY_DEBUG:FILEPATH=${installRepo}/zlib/lib/${zlibname}d.lib -DZLIB_LIBRARY_RELEASE:FILEPATH=${installRepo}/zlib/lib/${zlibname}.lib \