Warning, /frameworks/extra-cmake-modules/find-modules/FindOpenEXR.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2013-2014 Alex Merry <alex.merry@kdemail.net> 0002 # SPDX-FileCopyrightText: 2006 Alexander Neundorf <neundorf@kde.org> 0003 # 0004 # SPDX-License-Identifier: BSD-3-Clause 0005 0006 #[=======================================================================[.rst: 0007 FindOpenEXR 0008 ----------- 0009 0010 Try to find the OpenEXR libraries. 0011 0012 This will define the following variables: 0013 0014 ``OpenEXR_FOUND`` 0015 True if OpenEXR is available 0016 ``OpenEXR_LIBRARIES`` 0017 Link to these to use OpenEXR 0018 ``OpenEXR_INCLUDE_DIRS`` 0019 Include directory for OpenEXR 0020 ``OpenEXR_DEFINITIONS`` 0021 Compiler flags required to link against OpenEXR 0022 0023 and the following imported targets: 0024 0025 ``OpenEXR::IlmImf`` 0026 The OpenEXR core library 0027 0028 In general we recommend using the imported target, as it is easier to use. 0029 Bear in mind, however, that if the target is in the link interface of an 0030 exported library, it must be made available by the package config file. 0031 0032 Since pre-1.0.0. 0033 #]=======================================================================] 0034 0035 include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) 0036 0037 ecm_find_package_version_check(OpenEXR) 0038 0039 # use pkg-config to get the directories and then use these values 0040 # in the FIND_PATH() and FIND_LIBRARY() calls 0041 find_package(PkgConfig QUIET) 0042 pkg_check_modules(PC_OpenEXR QUIET OpenEXR) 0043 0044 set(OpenEXR_DEFINITIONS ${PC_OpenEXR_CFLAGS_OTHER}) 0045 0046 find_path(OpenEXR_INCLUDE_DIR ImfRgbaFile.h 0047 PATHS 0048 ${PC_OpenEXR_INCLUDEDIR} 0049 ${PC_OpenEXR_INCLUDE_DIRS} 0050 PATH_SUFFIXES OpenEXR 0051 ) 0052 0053 # Required libraries for OpenEXR 0054 find_library(OpenEXR_HALF_LIBRARY NAMES Half 0055 PATHS 0056 ${PC_OpenEXR_LIBDIR} 0057 ${PC_OpenEXR_LIBRARY_DIRS} 0058 ) 0059 find_library(OpenEXR_IEX_LIBRARY NAMES Iex 0060 PATHS 0061 ${PC_OpenEXR_LIBDIR} 0062 ${PC_OpenEXR_LIBRARY_DIRS} 0063 ) 0064 find_library(OpenEXR_IMATH_LIBRARY NAMES Imath 0065 PATHS 0066 ${PC_OpenEXR_LIBDIR} 0067 ${PC_OpenEXR_LIBRARY_DIRS} 0068 ) 0069 find_library(OpenEXR_ILMTHREAD_LIBRARY NAMES IlmThread 0070 PATHS 0071 ${PC_OpenEXR_LIBDIR} 0072 ${PC_OpenEXR_LIBRARY_DIRS} 0073 ) 0074 # This is the actual OpenEXR library 0075 find_library(OpenEXR_ILMIMF_LIBRARY NAMES IlmImf 0076 PATHS 0077 ${PC_OpenEXR_LIBDIR} 0078 ${PC_OpenEXR_LIBRARY_DIRS} 0079 ) 0080 0081 set(_OpenEXR_deps 0082 ${OpenEXR_HALF_LIBRARY} 0083 ${OpenEXR_IEX_LIBRARY} 0084 ${OpenEXR_IMATH_LIBRARY} 0085 ${OpenEXR_ILMTHREAD_LIBRARY}) 0086 0087 set(OpenEXR_LIBRARIES 0088 ${_OpenEXR_deps} 0089 ${OpenEXR_ILMIMF_LIBRARY}) 0090 0091 if (OpenEXR_INCLUDE_DIR AND EXISTS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h") 0092 file(STRINGS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h" openexr_version_str 0093 REGEX "^#define[\t ]+OPENEXR_VERSION_STRING[\t ]+\"[^\"]*\"") 0094 string(REGEX REPLACE "^#define[\t ]+OPENEXR_VERSION_STRING[\t ]+\"([^\"]*).*" 0095 "\\1" OpenEXR_VERSION_STRING "${openexr_version_str}") 0096 unset(openexr_version_str) 0097 endif () 0098 0099 include(FindPackageHandleStandardArgs) 0100 # find_package_handle_standard_args reports the value of the first variable 0101 # on success, so make sure this is the actual OpenEXR library 0102 find_package_handle_standard_args(OpenEXR 0103 FOUND_VAR OpenEXR_FOUND 0104 REQUIRED_VARS 0105 OpenEXR_ILMIMF_LIBRARY 0106 OpenEXR_HALF_LIBRARY 0107 OpenEXR_IEX_LIBRARY 0108 OpenEXR_IMATH_LIBRARY 0109 OpenEXR_ILMTHREAD_LIBRARY 0110 OpenEXR_INCLUDE_DIR 0111 VERSION_VAR OpenEXR_VERSION_STRING) 0112 0113 set(OpenEXR_INCLUDE_DIRS ${OpenEXR_INCLUDE_DIR}) 0114 0115 include(FeatureSummary) 0116 set_package_properties(OpenEXR PROPERTIES 0117 URL https://www.openexr.com/ 0118 DESCRIPTION "A library for handling OpenEXR high dynamic-range image files") 0119 0120 mark_as_advanced( 0121 OpenEXR_INCLUDE_DIR 0122 OpenEXR_LIBRARIES 0123 OpenEXR_DEFINITIONS 0124 OpenEXR_ILMIMF_LIBRARY 0125 OpenEXR_ILMTHREAD_LIBRARY 0126 OpenEXR_IMATH_LIBRARY 0127 OpenEXR_IEX_LIBRARY 0128 OpenEXR_HALF_LIBRARY 0129 ) 0130 0131 if(OpenEXR_FOUND AND NOT TARGET OpenEXR::IlmImf) 0132 add_library(OpenEXR::IlmImf UNKNOWN IMPORTED) 0133 set_target_properties(OpenEXR::IlmImf PROPERTIES 0134 IMPORTED_LOCATION "${OpenEXR_ILMIMF_LIBRARY}" 0135 INTERFACE_COMPILE_OPTIONS "${OpenEXR_DEFINITIONS}" 0136 INTERFACE_INCLUDE_DIRECTORIES "${OpenEXR_INCLUDE_DIR}" 0137 INTERFACE_LINK_LIBRARIES "${_OpenEXR_deps}" 0138 ) 0139 endif()