Update OpenEXR Find module to find v3 and <v2.3

Closed Amy spark requested to merge (removed):work/amyspark/openexr into master

In Krita bug 419277 it was reported that our Find module couldn't handle versions 2.3 or lower of OpenEXR, nor v3. The suggestion in the bug report was to use ECM, which in turn has the following issues:

  • It completely ignores the versioned suffix that OpenEXR applies to its libraries; this implies that it's relying on Linux's symlinks to point it to the correct library. This is a blocker for any level of support for Windows.

  • Secondly, but also less serious, it doesn't cover the IexMath and IlmImfUtil subcomponents.

This commit upstreams the modifications that I did to the current ECM module in order to support <v2.3 and v3, as follows:

  1. Find and use any CMake config module that OpenEXR provides.
  2. Failing that, construct the library suffix, and manually look up each component.
  3. Add IexMath and IlmImfUtil to the list of libraries.
  4. Add support for OpenEXR v3 and its list of components.

CCBUG: 419277

/cc @rempt

Merge request reports