@ -20,55 +20,89 @@ if(WIN32)
elseif ( MSVC )
elseif ( MSVC )
SET ( OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug )
SET ( OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug )
endif ( )
endif ( )
else ( )
set ( OPENEXR_ROOT "" )
endif ( )
endif ( )
SET ( LIBRARY _PATHS
SET ( SEARCH _PATHS
/ u s r / l i b
" $ { O P E N E X R _ R O O T } "
/ u s r / l o c a l / l i b
/ u s r
/ s w / l i b
/ u s r / l o c a l
/ o p t / l o c a l / l i b
/ s w
" $ { 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 t
" $ { O P E N E X R _ R O O T } / 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 " )
FIND_PATH ( OPENEXR_INCLUDE_PATH ImfRgbaFile.h
MACRO ( FIND_OPENEXR_LIBRARY LIBRARY_NAME LIBRARY_SUFFIX )
P A T H _ S U F F I X E S O p e n E X R
string ( TOUPPER "${LIBRARY_NAME}" LIBRARY_NAME_UPPER )
P A T H S
FIND_LIBRARY ( OPENEXR_ ${ LIBRARY_NAME_UPPER } _LIBRARY
/ u s r / i n c l u d e
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 }
/ u s r / l o c a l / i n c l u d e
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 }
/ s w / i n c l u d e
N O _ D E F A U L T _ P A T H
/ o p t / l o c a l / i n c l u d e
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 " )
" $ { 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 "
ENDMACRO ( )
" $ { O P E N E X R _ R O O T } / i n c l u d e " )
FIND_LIBRARY ( OPENEXR_HALF_LIBRARY
FOREACH ( SEARCH_PATH ${ SEARCH_PATHS } )
N A M E S H a l f
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 _ L I B S E A R C H _ S U F F I X E S }
P A T H _ S U F F I X E S O p e n E X R
P A T H S $ { L I B R A R Y _ P A T H 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 } / i n c l u d e " )
FIND_LIBRARY ( OPENEXR_IEX_LIBRARY
IF ( OPENEXR_INCLUDE_PATH )
N A M E S I e x
SET ( OPENEXR_VERSION_FILE "${OPENEXR_INCLUDE_PATH}/OpenEXRConfig.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 }
IF ( EXISTS ${ OPENEXR_VERSION_FILE } )
P A T H S $ { L I B R A R Y _ P A T H S } )
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
IF ( OPENEXR_VERSION_MAJOR AND OPENEXR_VERSION_MINOR )
N A M E S I m a t h
set ( OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}" )
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 }
ENDIF ( )
P A T H S $ { L I B R A R Y _ P A T H S } )
FIND_LIBRARY ( OPENEXR_ILMIMF_LIBRARY
SET ( LIBRARY_SUFFIXES
N A M E S I l m I m f
" - $ { O P E N E X R _ V E R S I O N } "
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 }
" - $ { O P E N E X R _ V E R S I O N } _ s "
P A T H S $ { L I B R A R Y _ P A T H 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
FOREACH ( LIBRARY_SUFFIX ${ LIBRARY_SUFFIXES } )
N A M E S I l m T h r e a d
FIND_OPENEXR_LIBRARY ( "Half" ${ LIBRARY_SUFFIX } )
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 }
FIND_OPENEXR_LIBRARY ( "Iex" ${ LIBRARY_SUFFIX } )
P A T H S $ { L I B R A R Y _ P A T H S } )
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 )
IF ( OPENEXR_FOUND )
SET ( OPENEXR_FOUND TRUE )
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_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 )
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 ( )
ENDIF ( )