2020.12.26 19:47 "[Tiff] Wrong information about request and avalability of external codecs", by Miguel Medalha

2020.12.28 23:03 "Re: [Tiff] Wrong information about request and avalability of external codecs", by Roger Leigh

Note that:

if(ZLIB_FOUND)
   set(ZLIB_FOUND TRUE)
endif()

Is redundant. If ZLIB_FOUND is TRUE/ON, then there’s no need to set it to TRUE/ON since it’s already set. ZLIB_FOUND is completely handled by find_package(ZLIB). You don’t need to initialise it (in fact, you shouldn’t in case it was already called), and you don’t need to assign it.

Just do something like:

set(ZIP_SUPPORT 0)
find_package(ZLIB)
option(zlib "use zlib (required for Deflate compression)” ${ZLIB_FOUND})

if(zlib AND ZLIB_FOUND)
  set(ZIP_SUPPORT 1)
endif()

and similarly for the other options. You’ve got two variables to deal with: the user option and the feature check, and you enable the feature if both are true. You shouldn’t need anything more complex. You could also do:

if(zlib AND NOT ZLIB_FOUND)
  message(FATAL_ERROR “zlib required but not found”)
endif()

However, this really depends upon whether the option is a “request” or a “requirement”. Should we fail if a requested feature was not available? I’d argue yes, but only if the option was explicitly set by the user, rather than being defaulted. Note how I’ve defaulted the option above with ZLIB_FOUND so it will be defaulted if known to be present, so this behaviour will be implemented with this strategy.

Would someone here be willing to verify the code (about 150 lines in total) for the other libraries before presenting this to gitlab?

It’s perfectly fine to put work in progress onto GitLab. Just add a "WIP: " prefix. The code review facilities GitLab offers are for this purpose.

Kind regards,

Roger