diff --git a/CMakeLists.txt b/CMakeLists.txt index 8754b2f..face38e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,10 @@ if (UNIX) endif() endif() -find_package(OpenEXR) +find_package(OpenEXR 3.0 CONFIG QUIET) +if(NOT OpenEXR_FOUND) + find_package(OpenEXR) +endif() set_package_properties(OpenEXR PROPERTIES TYPE OPTIONAL PURPOSE "Required for the QImage plugin for OpenEXR images" diff --git a/src/imageformats/CMakeLists.txt b/src/imageformats/CMakeLists.txt index 6d41198..4e59ad4 100644 --- a/src/imageformats/CMakeLists.txt +++ b/src/imageformats/CMakeLists.txt @@ -58,7 +58,11 @@ install(FILES jp2.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugi if(OpenEXR_FOUND) kimageformats_add_plugin(kimg_exr JSON "exr.json" SOURCES exr.cpp) - target_link_libraries(kimg_exr OpenEXR::IlmImf) + if(TARGET OpenEXR::OpenEXR) + target_link_libraries(kimg_exr OpenEXR::OpenEXR) + else() + target_link_libraries(kimg_exr OpenEXR::IlmImf) + endif() kde_target_enable_exceptions(kimg_exr PRIVATE) install(FILES exr.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/) diff --git a/src/imageformats/exr.cpp b/src/imageformats/exr.cpp index ea9a0d9..092d592 100644 --- a/src/imageformats/exr.cpp +++ b/src/imageformats/exr.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include