@ -20,55 +20,89 @@ if(WIN32)
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 " )
SET ( SEARCH _PATHS
" $ { O P E N E X R _ R O O T } "
/ u s r
/ u s r / l o c a l
/ s w
/ o p t
" $ { 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 " )
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 " )
MACRO ( FIND_OPENEXR_LIBRARY LIBRARY_NAME LIBRARY_SUFFIX )
string ( TOUPPER "${LIBRARY_NAME}" LIBRARY_NAME_UPPER )
FIND_LIBRARY ( OPENEXR_ ${ LIBRARY_NAME_UPPER } _LIBRARY
N A M E S $ { L I B R A R Y _ N A M E } $ { L I B R A R Y _ S U F F I 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 }
N O _ D E F A U L T _ P A T H
P A T H S " $ { S E A R C H _ P A T H } / l i b " " $ { S E A R C H _ P A T H } / l i b / s t a t i c " )
ENDMACRO ( )
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 } )
FOREACH ( SEARCH_PATH ${ SEARCH_PATHS } )
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
N O _ D E F A U L T _ P A T H
P A T H S
" $ { S E A R C H _ P A T H } / i n c l u d e " )
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 } )
IF ( OPENEXR_INCLUDE_PATH )
SET ( OPENEXR_VERSION_FILE "${OPENEXR_INCLUDE_PATH}/OpenEXRConfig.h" )
IF ( EXISTS ${ OPENEXR_VERSION_FILE } )
FILE ( STRINGS ${ OPENEXR_VERSION_FILE } contents REGEX "#define OPENEXR_VERSION_MAJOR " )
IF ( ${ contents } MATCHES "#define OPENEXR_VERSION_MAJOR ([0-9]+)" )
SET ( OPENEXR_VERSION_MAJOR "${CMAKE_MATCH_1}" )
ENDIF ( )
FILE ( STRINGS ${ OPENEXR_VERSION_FILE } contents REGEX "#define OPENEXR_VERSION_MINOR " )
IF ( ${ contents } MATCHES "#define OPENEXR_VERSION_MINOR ([0-9]+)" )
SET ( OPENEXR_VERSION_MINOR "${CMAKE_MATCH_1}" )
ENDIF ( )
ENDIF ( )
ENDIF ( )
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 } )
IF ( OPENEXR_VERSION_MAJOR AND OPENEXR_VERSION_MINOR )
set ( OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}" )
ENDIF ( )
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 } )
SET ( LIBRARY_SUFFIXES
" - $ { O P E N E X R _ V E R S I O N } "
" - $ { O P E N E X R _ V E R S I O N } _ s "
" - $ { O P E N E X R _ V E R S I O N } _ d "
" - $ { O P E X E X R _ V E R S I O N } _ s _ d "
" "
" _ s "
" _ d "
" _ s _ d " )
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 } )
FOREACH ( LIBRARY_SUFFIX ${ LIBRARY_SUFFIXES } )
FIND_OPENEXR_LIBRARY ( "Half" ${ LIBRARY_SUFFIX } )
FIND_OPENEXR_LIBRARY ( "Iex" ${ LIBRARY_SUFFIX } )
FIND_OPENEXR_LIBRARY ( "Imath" ${ LIBRARY_SUFFIX } )
FIND_OPENEXR_LIBRARY ( "IlmImf" ${ LIBRARY_SUFFIX } )
FIND_OPENEXR_LIBRARY ( "IlmThread" ${ LIBRARY_SUFFIX } )
IF ( OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY )
SET ( OPENEXR_FOUND TRUE )
BREAK ( )
ENDIF ( )
UNSET ( OPENEXR_IMATH_LIBRARY )
UNSET ( OPENEXR_ILMIMF_LIBRARY )
UNSET ( OPENEXR_IEX_LIBRARY )
UNSET ( OPENEXR_ILMTHREAD_LIBRARY )
UNSET ( OPENEXR_HALF_LIBRARY )
ENDFOREACH ( )
IF ( OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY )
SET ( OPENEXR_FOUND TRUE )
IF ( OPENEXR_FOUND )
BREAK ( )
ENDIF ( )
UNSET ( OPENEXR_INCLUDE_PATH )
UNSET ( OPENEXR_VERSION_FILE )
UNSET ( OPENEXR_VERSION_MAJOR )
UNSET ( OPENEXR_VERSION_MINOR )
UNSET ( OPENEXR_VERSION )
ENDFOREACH ( )
IF ( OPENEXR_FOUND )
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 ( )