1 # The script is taken from http://code.google.com/p/nvidia-texture-tools/
4 # Try to find OpenEXR's libraries, and include path.
5 # Once done this will define:
7 # OPENEXR_FOUND = OpenEXR found.
8 # OPENEXR_INCLUDE_PATHS = OpenEXR include directories.
9 # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR.
12 SET(OPENEXR_LIBRARIES "")
13 SET(OPENEXR_LIBSEARCH_SUFFIXES "")
14 file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
17 SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder")
19 SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug)
21 SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug)
32 "${ProgramFiles_ENV_PATH}/OpenEXR/lib/static"
33 "${OPENEXR_ROOT}/lib")
35 FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h
42 "${ProgramFiles_ENV_PATH}/OpenEXR/include"
43 "${OPENEXR_ROOT}/include")
45 FIND_LIBRARY(OPENEXR_HALF_LIBRARY
47 PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
48 PATHS ${LIBRARY_PATHS})
50 FIND_LIBRARY(OPENEXR_IEX_LIBRARY
52 PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
53 PATHS ${LIBRARY_PATHS})
55 FIND_LIBRARY(OPENEXR_IMATH_LIBRARY
57 PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
58 PATHS ${LIBRARY_PATHS})
60 FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY
62 PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
63 PATHS ${LIBRARY_PATHS})
65 FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY
67 PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
68 PATHS ${LIBRARY_PATHS})
70 IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
71 SET(OPENEXR_FOUND TRUE)
72 SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE PATH "The include paths needed to use OpenEXR")
73 SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR" FORCE)
77 IF(NOT OPENEXR_FIND_QUIETLY)
78 MESSAGE(STATUS "Found OpenEXR: ${OPENEXR_ILMIMF_LIBRARY}")
80 if(PKG_CONFIG_FOUND AND NOT OPENEXR_VERSION)
81 get_filename_component(OPENEXR_LIB_PATH "${OPENEXR_ILMIMF_LIBRARY}" PATH)
82 if(EXISTS "${OPENEXR_LIB_PATH}/pkgconfig/OpenEXR.pc")
83 execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --modversion "${OPENEXR_LIB_PATH}/pkgconfig/OpenEXR.pc"
84 RESULT_VARIABLE PKG_CONFIG_PROCESS
85 OUTPUT_VARIABLE OPENEXR_VERSION
86 OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
87 if(NOT PKG_CONFIG_PROCESS EQUAL 0)
88 SET(OPENEXR_VERSION "Unknown")
92 if(NOT OPENEXR_VERSION)
93 SET(OPENEXR_VERSION "Unknown")
96 IF(OPENEXR_FIND_REQUIRED)
97 MESSAGE(FATAL_ERROR "Could not find OpenEXR library")
102 OPENEXR_INCLUDE_PATHS
104 OPENEXR_ILMIMF_LIBRARY
105 OPENEXR_IMATH_LIBRARY
108 OPENEXR_ILMTHREAD_LIBRARY)