Restrict accepted OpenEXR version (#119)

* CMake: Validate the version of the system OpenEXR

Let CMake validate that the version of the OpenEXR library we found
satisfies what was specified when calling `find_package(OpenEXR)`, for
example if a minimum or exact version were required.

* CMake: Restrict system OpenEXR versions to 2.3+

Versions prior to 2.3 are not compatible with C++17, due to for example
using the `register` storage class specifier or dynamic exception
specifications via the `throw` keyword.

Fixes regression introduced in cb2e8ae397
for systems with OpenEXR <2.3.

Fixes #117.
This commit is contained in:
Pierre Moreau 2021-04-01 18:31:04 +02:00 • committed by GitHub
parent 7bcf583201
commit e1ebc7218a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -227,6 +227,7 @@ find_package_handle_standard_args (OpenEXR
REQUIRED_VARS ILMBASE_INCLUDE_PATH OPENEXR_INCLUDE_PATH
OPENEXR_IMATH_LIBRARY OPENEXR_ILMIMF_LIBRARY
OPENEXR_IEX_LIBRARY OPENEXR_HALF_LIBRARY
VERSION_VAR OPENEXR_VERSION
)
if (OPENEXR_FOUND)

View file

@ -45,7 +45,7 @@ set (ZLIB_LIBRARIES ${ZLIB_LIBARIES} PARENT_SCOPE)
###########################################################################
# OpenEXR
find_package (OpenEXR)
find_package (OpenEXR 2.3) # 2.3 is the first version compatible with C++17
if (OPENEXR_FOUND)
message (STATUS "Found OpenEXR version ${OPENEXR_VERSION}")