build: Fix the CMake file for cross-platform builds that require `libm` Detect the availability of `libm` on the target platform. Previously, `libm` was detected on the host platform only. Also introduce the variable `PNG_LINK_LIBRARIES`. Stop using `M_LIBRARY`, which was not namespace-clean.