use of system's libraries when enabled by CMake option: libpng and zlib

Hi Robert,

I reworked the earlier patch (see #178) to use the system's zlib according to your remarks in the previous pull request to use DUSE_SYSTEM_ZLIB. (defaults to OFF -- using bundled one)
This pull requests also fixes #180, as they should "go in" at the same time to avoid build errors.

Also, this fixes #182. using DUSE_SYSTEM_LIBPNG. Also here, the default is to use the bundled version.

Closes: #178 and #180