COLLADA Armature bake animation export fixed( needs more testing )
[blender.git] / build_files / cmake / Modules / FindOpenEXR.cmake
1 # - Find OpenEXR library
2 # Find the native OpenEXR includes and library
3 # This module defines
4 #  OPENEXR_INCLUDE_DIRS, where to find ImfXdr.h, etc. Set when
5 #                        OPENEXR_INCLUDE_DIR is found.
6 #  OPENEXR_LIBRARIES, libraries to link against to use OpenEXR.
7 #  OPENEXR_ROOT_DIR, The base directory to search for OpenEXR.
8 #                    This can also be an environment variable.
9 #  OPENEXR_FOUND, If false, do not try to use OpenEXR.
10 #
11 # For indervidual library access these advanced settings are available
12 #  OPENEXR_HALF_LIBRARY, Path to Half library
13 #  OPENEXR_IEX_LIBRARY, Path to Half library
14 #  OPENEXR_ILMIMF_LIBRARY, Path to Ilmimf library
15 #  OPENEXR_ILMTHREAD_LIBRARY, Path to IlmThread library
16 #  OPENEXR_IMATH_LIBRARY, Path to Imath library
17 #
18 # also defined, but not for general use are
19 #  OPENEXR_LIBRARY, where to find the OpenEXR library.
20
21 #=============================================================================
22 # Copyright 2011 Blender Foundation.
23 #
24 # Distributed under the OSI-approved BSD License (the "License");
25 # see accompanying file Copyright.txt for details.
26 #
27 # This software is distributed WITHOUT ANY WARRANTY; without even the
28 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
29 # See the License for more information.
30 #=============================================================================
31
32 # If OPENEXR_ROOT_DIR was defined in the environment, use it.
33 IF(NOT OPENEXR_ROOT_DIR AND NOT $ENV{OPENEXR_ROOT_DIR} STREQUAL "")
34   SET(OPENEXR_ROOT_DIR $ENV{OPENEXR_ROOT_DIR})
35 ENDIF()
36
37 SET(_openexr_FIND_COMPONENTS
38   Half
39   Iex
40   IlmImf
41   IlmThread
42   Imath
43 )
44
45 SET(_openexr_SEARCH_DIRS
46   ${OPENEXR_ROOT_DIR}
47   /usr/local
48   /sw # Fink
49   /opt/local # DarwinPorts
50   /opt/csw # Blastwave
51 )
52
53 FIND_PATH(OPENEXR_INCLUDE_DIR
54   NAMES
55     ImfXdr.h
56   HINTS
57     ${_openexr_SEARCH_DIRS}
58   PATH_SUFFIXES
59     include/OpenEXR
60 )
61
62 SET(_openexr_LIBRARIES)
63 FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
64   STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
65
66   FIND_LIBRARY(OPENEXR_${UPPERCOMPONENT}_LIBRARY
67     NAMES
68       ${COMPONENT}
69     HINTS
70       ${_openexr_SEARCH_DIRS}
71     PATH_SUFFIXES
72       lib64 lib
73     )
74   LIST(APPEND _openexr_LIBRARIES "${OPENEXR_${UPPERCOMPONENT}_LIBRARY}")
75 ENDFOREACH()
76
77 # handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if 
78 # all listed variables are TRUE
79 INCLUDE(FindPackageHandleStandardArgs)
80 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR  DEFAULT_MSG
81     _openexr_LIBRARIES OPENEXR_INCLUDE_DIR)
82
83 IF(OPENEXR_FOUND)
84   SET(OPENEXR_LIBRARIES ${_openexr_LIBRARIES})
85   SET(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR})
86 ENDIF()
87
88 MARK_AS_ADVANCED(OPENEXR_INCLUDE_DIR)
89 FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
90   STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
91   MARK_AS_ADVANCED(OPENEXR_${UPPERCOMPONENT}_LIBRARY)
92 ENDFOREACH()