BUILD: fix building with libpng-1.6
CMAKE: make paths modifiable

also make sure no relative paths get passed to the preprocessor flags