CMake build system improvements

* respect system cflags
* fix zlib include dir
* allow to build both shared and static libraries at once