If you want to use "cmake" (see www.cmake.org), type
cd [your libpng source directory]
cmake . -DCMAKE_INSTALL_PREFIX=/path
make
make install
where "/path" points to the installation directory where you want to put the libpng "lib", "include", and "bin" subdirectories.
This will download libpng from the official "git" repository and build it in your "libpng" directory.
git clone https://github.com/glennrp/libpng.git libpng
cd libpng
./autogen.sh
./configure [--prefix=/path]
make install
where "/path" points to the installation directory where you want to put the libpng "lib", "include", and "bin" subdirectories.