Merging r50049 through r50076 from trunk into soc-2011-tomato
[blender.git] / build_files / cmake / Modules / FindOpenColorIO.cmake
1 # - Find OpenColorIO library
2 # Find the native OpenColorIO includes and library
3 # This module defines
4 #  OPENCOLORIO_INCLUDE_DIRS, where to find OpenColorIO.h, Set when
5 #                            OPENCOLORIO_INCLUDE_DIR is found.
6 #  OPENCOLORIO_LIBRARIES, libraries to link against to use OpenColorIO.
7 #  OPENCOLORIO_ROOT_DIR, The base directory to search for OpenColorIO.
8 #                        This can also be an environment variable.
9 #  OPENCOLORIO_FOUND, If false, do not try to use OpenColorIO.
10 #
11 # also defined, but not for general use are
12 #  OPENCOLORIO_LIBRARY, where to find the OpenColorIO library.
13
14 #=============================================================================
15 # Copyright 2012 Blender Foundation.
16 #
17 # Distributed under the OSI-approved BSD License (the "License");
18 # see accompanying file Copyright.txt for details.
19 #
20 # This software is distributed WITHOUT ANY WARRANTY; without even the
21 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 # See the License for more information.
23 #=============================================================================
24
25 # If OPENCOLORIO_ROOT_DIR was defined in the environment, use it.
26 IF(NOT OPENCOLORIO_ROOT_DIR AND NOT $ENV{OPENCOLORIO_ROOT_DIR} STREQUAL "")
27   SET(OPENCOLORIO_ROOT_DIR $ENV{OPENCOLORIO_ROOT_DIR})
28 ENDIF()
29
30 SET(_opencolorio_SEARCH_DIRS
31   ${OPENCOLORIO_ROOT_DIR}
32   /usr/local
33   /sw # Fink
34   /opt/local # DarwinPorts
35   /opt/csw # Blastwave
36 )
37
38 FIND_PATH(OPENCOLORIO_INCLUDE_DIR
39   NAMES
40     OpenColorIO/OpenColorIO.h
41   HINTS
42     ${_opencolorio_SEARCH_DIRS}
43   PATH_SUFFIXES
44     include
45 )
46
47 FIND_LIBRARY(OPENCOLORIO_LIBRARY
48   NAMES
49     OCIO OpenColorIO
50   HINTS
51     ${_opencolorio_SEARCH_DIRS}
52   PATH_SUFFIXES
53     lib64 lib
54   )
55
56 # handle the QUIETLY and REQUIRED arguments and set OPENCOLORIO_FOUND to TRUE if 
57 # all listed variables are TRUE
58 INCLUDE(FindPackageHandleStandardArgs)
59 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenColorIO DEFAULT_MSG
60     OPENCOLORIO_LIBRARY OPENCOLORIO_INCLUDE_DIR)
61
62 IF(OPENCOLORIO_FOUND)
63   SET(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARY})
64   SET(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO_INCLUDE_DIR})
65 ENDIF(OPENCOLORIO_FOUND)
66
67 MARK_AS_ADVANCED(
68   OPENCOLORIO_INCLUDE_DIR
69   OPENCOLORIO_LIBRARY
70 )
71