From Laurens Voerman, I have modified the FindOpenEXR.cmake to find the debug libraries, and to define a variable

(OPENEXR_LIBRARIES_VARS) with the variable names that might have a _DEBUG version defined.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14830 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-04-13 09:50:27 +00:00
parent 0335ea3760
commit a711fdba36
2 changed files with 33 additions and 69 deletions

View File

@ -9,6 +9,7 @@
# #
# Created by Robert Osfield. # Created by Robert Osfield.
FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
$ENV{OPENEXR_DIR}/include $ENV{OPENEXR_DIR}/include
$ENV{OPENEXR_DIR} $ENV{OPENEXR_DIR}
@ -23,8 +24,11 @@ FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
/usr/freeware/include /usr/freeware/include
) )
FIND_LIBRARY(OPENEXR_IlmIlf_LIBRARY # Macro to find exr libraries (deduplicating search paths)
NAMES IlmImf # example: OPENEXR_FIND_VAR(OPENEXR_IlmIlf_LIBRARY IlmIlf)
MACRO(OPENEXR_FIND_VAR varname libname)
FIND_LIBRARY( ${varname}
NAMES ${libname}
PATHS PATHS
$ENV{OPENEXR_DIR}/lib $ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR} $ENV{OPENEXR_DIR}
@ -37,64 +41,24 @@ FIND_LIBRARY(OPENEXR_IlmIlf_LIBRARY
/opt/csw/lib /opt/csw/lib
/opt/lib /opt/lib
/usr/freeware/lib64 /usr/freeware/lib64
) )
ENDMACRO(OPENEXR_FIND_VAR)
FIND_LIBRARY(OPENEXR_IlmThread_LIBRARY # Macro to find exr libraries (and debug versions)
NAMES IlmThread # example: OPENEXR_FIND(IlmIlf)
PATHS MACRO(OPENEXR_FIND libname)
$ENV{OPENEXR_DIR}/lib OPENEXR_FIND_VAR(OPENEXR_${libname}_LIBRARY ${libname})
$ENV{OPENEXR_DIR} OPENEXR_FIND_VAR(OPENEXR_${libname}_LIBRARY_DEBUG ${libname}d)
~/Library/Frameworks ENDMACRO(OPENEXR_FIND)
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
OPENEXR_FIND(IlmIlf)
FIND_LIBRARY(OPENEXR_Iex_LIBRARY OPENEXR_FIND(IlmThread)
NAMES Iex OPENEXR_FIND(Iex)
PATHS OPENEXR_FIND(Half)
$ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(OPENEXR_Half_LIBRARY
NAMES Half
PATHS
$ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
SET(OPENEXR_FOUND "NO") SET(OPENEXR_FOUND "NO")
IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY) IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)
SET(OPENEXR_LIBRARIES SET(OPENEXR_LIBRARIES ${OPENEXR_IlmIlf_LIBRARY} ${OPENEXR_IlmThread_LIBRARY} ${OPENEXR_Half_LIBRARY} ${OPENEXR_Iex_LIBRARY} )
${OPENEXR_IlmIlf_LIBRARY} SET(OPENEXR_LIBRARIES_VARS OPENEXR_IlmIlf_LIBRARY OPENEXR_IlmThread_LIBRARY OPENEXR_Half_LIBRARY OPENEXR_Iex_LIBRARY )
${OPENEXR_IlmThread_LIBRARY}
${OPENEXR_Half_LIBRARY}
${OPENEXR_Iex_LIBRARY}
)
SET(OPENEXR_FOUND "YES") SET(OPENEXR_FOUND "YES")
ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY) ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)

View File

@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES( ${OPENEXR_INCLUDE_DIR}/OpenEXR )
SET(TARGET_SRC ReaderWriterEXR.cpp ) SET(TARGET_SRC ReaderWriterEXR.cpp )
SET(TARGET_EXTERNAL_LIBRARIES ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARY} ) SET(TARGET_LIBRARIES_VARS ${OPENEXR_LIBRARIES_VARS} ZLIB_LIBRARY)
#### end var setup ### #### end var setup ###
SETUP_PLUGIN(exr) SETUP_PLUGIN(exr)