Open flsobral opened 4 months ago
Overwriting the existing pnglibconf is the expected behavior?
Yes. Modify the file pngusr.dfa instead. This is not cmake specific.
pnglibconf.h should NEVER be modified; it's almost impossible to get right which is why the whole configuration stuff was created.
See contrib/conftest
for examples and the documentation (in the README file.)
I think pngusr.dfa might not be included; it should be included immediately after pnglibconf.dfa. Support for DFA_XTRA is also desirable because that avoids the need to edit the checked-in source file. See Makefile.am line 310 on. I can't work out where this is in cmake.
Currently, this is how I use libpng in my cross platform project:
This works for me now, but I can't shake the feeling that there should be a way of configuring the options instead, but I couldn't find out how.
EDIT: Actually, pnglibconf.h gets overwritten by a new one during build. The only way I got it to work was using this instead:
file(READ ${libpng_BINARY_DIR}/pnglibconf.h FILE_CONTENTS)
This way the build fails the first time because the file isn't available, but subsequent builds works fine.
Overwriting the existing pnglibconf is the expected behavior?