Update the main CMake file and the auxiliary test scripts accordingly. This is a cherry-pick of commit fe277b7752990be35523832a546aec478437968a from branch 'libpng18'.