# The script is taken from http://code.google.com/p/nvidia-texture-tools/
#
# Try to find OpenEXR's libraries, and include path.
# Once done this will define:
#
# OPENEXR_FOUND = OpenEXR found.
# OPENEXR_INCLUDE_PATHS = OpenEXR include directories.
# OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR.
#
SET ( OPENEXR_LIBRARIES "" )
SET ( OPENEXR_LIBSEARCH_SUFFIXES "" )
file ( TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH )
if ( WIN32 )
SET ( OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \" Deploy\ " folder" )
if ( CMAKE_CL_64 )
SET ( OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug )
elseif ( MSVC )
SET ( OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug )
endif ( )
else ( )
set ( OPENEXR_ROOT "" )
endif ( )
SET ( LIBRARY_PATHS
/ u s r / l i b
/ u s r / l o c a l / l i b
/ s w / l i b
/ o p t / l o c a l / l i b
" $ { P r o g r a m F i l e s _ E N V _ P A T H } / O p e n E X R / l i b / s t a t i c "
" $ { O P E N E X R _ R O O T } / l i b " )
FIND_PATH ( OPENEXR_INCLUDE_PATH ImfRgbaFile.h
P A T H _ S U F F I X E S O p e n E X R
P A T H S
/ u s r / i n c l u d e
/ u s r / l o c a l / i n c l u d e
/ s w / i n c l u d e
/ o p t / l o c a l / i n c l u d e
" $ { P r o g r a m F i l e s _ E N V _ P A T H } / O p e n E X R / i n c l u d e "
" $ { O P E N E X R _ R O O T } / i n c l u d e " )
FIND_LIBRARY ( OPENEXR_HALF_LIBRARY
N A M E S H a l f
P A T H _ S U F F I X E S $ { O P E N E X R _ L I B S E A R C H _ S U F F I X E S }
P A T H S $ { L I B R A R Y _ P A T H S } )
FIND_LIBRARY ( OPENEXR_IEX_LIBRARY
N A M E S I e x
P A T H _ S U F F I X E S $ { O P E N E X R _ L I B S E A R C H _ S U F F I X E S }
P A T H S $ { L I B R A R Y _ P A T H S } )
FIND_LIBRARY ( OPENEXR_IMATH_LIBRARY
N A M E S I m a t h
P A T H _ S U F F I X E S $ { O P E N E X R _ L I B S E A R C H _ S U F F I X E S }
P A T H S $ { L I B R A R Y _ P A T H S } )
FIND_LIBRARY ( OPENEXR_ILMIMF_LIBRARY
N A M E S I l m I m f
P A T H _ S U F F I X E S $ { O P E N E X R _ L I B S E A R C H _ S U F F I X E S }
P A T H S $ { L I B R A R Y _ P A T H S } )
FIND_LIBRARY ( OPENEXR_ILMTHREAD_LIBRARY
N A M E S I l m T h r e a d
P A T H _ S U F F I X E S $ { O P E N E X R _ L I B S E A R C H _ S U F F I X E S }
P A T H S $ { L I B R A R Y _ P A T H S } )
IF ( OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY )
SET ( OPENEXR_FOUND TRUE )
SET ( OPENEXR_INCLUDE_PATHS ${ OPENEXR_INCLUDE_PATH } CACHE PATH "The include paths needed to use OpenEXR" )
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 )
ENDIF ( )
IF ( OPENEXR_FOUND )
IF ( NOT OPENEXR_FIND_QUIETLY )
MESSAGE ( STATUS "Found OpenEXR: ${OPENEXR_ILMIMF_LIBRARY}" )
ENDIF ( )
if ( PKG_CONFIG_FOUND AND NOT OPENEXR_VERSION )
get_filename_component ( OPENEXR_LIB_PATH "${OPENEXR_ILMIMF_LIBRARY}" PATH )
if ( EXISTS "${OPENEXR_LIB_PATH}/pkgconfig/OpenEXR.pc" )
execute_process ( COMMAND ${ PKG_CONFIG_EXECUTABLE } --modversion "${OPENEXR_LIB_PATH}/pkgconfig/OpenEXR.pc"
R E S U L T _ V A R I A B L E P K G _ C O N F I G _ P R O C E S S
O U T P U T _ V A R I A B L E O P E N E X R _ V E R S I O N
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E E R R O R _ Q U I E T )
if ( NOT PKG_CONFIG_PROCESS EQUAL 0 )
SET ( OPENEXR_VERSION "Unknown" )
endif ( )
endif ( )
endif ( )
if ( NOT OPENEXR_VERSION )
SET ( OPENEXR_VERSION "Unknown" )
endif ( )
ELSE ( )
IF ( OPENEXR_FIND_REQUIRED )
MESSAGE ( FATAL_ERROR "Could not find OpenEXR library" )
ENDIF ( )
ENDIF ( )
MARK_AS_ADVANCED (
O P E N E X R _ I N C L U D E _ P A T H S
O P E N E X R _ L I B R A R I E S
O P E N E X R _ I L M I M F _ L I B R A R Y
O P E N E X R _ I M A T H _ L I B R A R Y
O P E N E X R _ I E X _ L I B R A R Y
O P E N E X R _ H A L F _ L I B R A R Y
O P E N E X R _ I L M T H R E A D _ L I B R A R Y )