1 diff --git a/CMakeLists.txt b/CMakeLists.txt
2 index 8955357ff97..ea56c84bb11 100644
5 @@ -363,8 +363,13 @@ endif ()
9 -macro_optional_find_package(OpenEXR)
10 -macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR)
11 +macro_optional_find_package(Imath 3.0 CONFIG QUIET)
12 +if(TARGET Imath::Imath)
13 + set(OPENEXR_LIBRARIES Imath::Imath)
15 + macro_optional_find_package(OpenEXR)
17 +macro_bool_to_01(OpenEXR_FOUND HAVE_OPENEXR)
20 ## Test for GNU Scientific Library
21 diff --git a/libs/pigment/CMakeLists.txt b/libs/pigment/CMakeLists.txt
22 index a039251e2ad..6eb6a8e70b6 100644
23 --- a/libs/pigment/CMakeLists.txt
24 +++ b/libs/pigment/CMakeLists.txt
25 @@ -12,7 +12,7 @@ include_directories( ${PIGMENT_INCLUDES} ${Boost_INCLUDE_DIR})
27 set(FILE_OPENEXR_SOURCES)
31 include_directories(${OPENEXR_INCLUDE_DIR})
32 set(LINK_OPENEXR_LIB ${OPENEXR_LIBRARIES})
33 add_definitions(${OPENEXR_DEFINITIONS})
34 diff --git a/plugins/colorengines/lcms2/CMakeLists.txt b/plugins/colorengines/lcms2/CMakeLists.txt
35 index 77807ff9702..920adbeaf87 100644
36 --- a/plugins/colorengines/lcms2/CMakeLists.txt
37 +++ b/plugins/colorengines/lcms2/CMakeLists.txt
38 @@ -31,7 +31,7 @@ include_directories(
39 ${CMAKE_CURRENT_SOURCE_DIR}/colorprofiles
42 -if (HAVE_LCMS24 AND OPENEXR_FOUND)
43 +if (HAVE_LCMS24 AND OpenEXR_FOUND)
45 ${CMAKE_CURRENT_SOURCE_DIR}/colorspaces/gray_f16
46 ${CMAKE_CURRENT_SOURCE_DIR}/colorspaces/rgb_f16
47 @@ -41,7 +41,7 @@ endif ()
49 set(FILE_OPENEXR_SOURCES)
53 include_directories(${OPENEXR_INCLUDE_DIR})
54 set(LINK_OPENEXR_LIB ${OPENEXR_LIBRARIES})
55 add_definitions(${OPENEXR_DEFINITIONS})
56 @@ -80,7 +80,7 @@ set ( lcmsengine_SRCS
60 -if (HAVE_LCMS24 AND OPENEXR_FOUND)
61 +if (HAVE_LCMS24 AND OpenEXR_FOUND)
64 colorspaces/gray_f16/GrayF16ColorSpace.cpp
65 diff --git a/plugins/colorengines/lcms2/tests/CMakeLists.txt b/plugins/colorengines/lcms2/tests/CMakeLists.txt
66 index 2540acc834c..77bd0b3fe4a 100644
67 --- a/plugins/colorengines/lcms2/tests/CMakeLists.txt
68 +++ b/plugins/colorengines/lcms2/tests/CMakeLists.txt
69 @@ -12,7 +12,7 @@ include_directories( ../colorspaces/cmyk_u16
75 include_directories(${OPENEXR_INCLUDE_DIR})
77 include_directories( ${PIGMENT_INCLUDES} ${LCMS2_INCLUDE_DIR} )
78 diff --git a/CMakeLists.txt b/CMakeLists.txt
79 index 4a77c4be50b..89636205c2b 100644
82 @@ -341,6 +341,7 @@ endif ()
83 macro_optional_find_package(Imath 3.0 CONFIG QUIET)
84 if(TARGET Imath::Imath)
85 set(OPENEXR_LIBRARIES Imath::Imath)
86 + set(OpenEXR_FOUND TRUE)
88 macro_optional_find_package(OpenEXR)