OpenSceneGraph/CMakeModules/FindOpenEXR.cmake
Raymond de Vries 41dda781ee attached fixes for configuring and building the osgPlugin exr with Visual Studio and using out-of-the-box builds of ilmbase and openexr, i.e. without manual/extra config for using these 2 libs with the OSG.
Previously, the assumption was made that ilmbase and openexr were installed in a common directory and hence the header files and libs were both found in that common directory. That is not consistent with other libs and this submission makes it consistent and therefore the OSG configures out of the box. I made this work for ilmbase-2.1.0.tar.gz / openexr-2.1.0.tar.gz and ilmbase-2.2.0.tar.gz / openexr-2.2.0.tar.gz
2017-11-14 10:59:08 +00:00

62 lines
1.7 KiB
CMake

# Locate OpenEXR
# This module defines
# OPENEXR_LIBRARY
# OPENEXR_FOUND, if false, do not try to link to OpenEXR
# OPENEXR_INCLUDE_DIR, where to find the headers
#
# $OPENEXR_DIR is an environment variable that would
# correspond to the ./configure --prefix=$OPENEXR_DIR
#
# Created by Robert Osfield.
FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
$ENV{OPENEXR_DIR}/include
$ENV{OPENEXR_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
)
# Macro to find exr libraries (deduplicating search paths)
# example: OPENEXR_FIND_VAR(OPENEXR_IlmImf_LIBRARY IlmImf)
MACRO(OPENEXR_FIND_VAR varname libname)
FIND_LIBRARY( ${varname}
NAMES ${libname} ${libname}-2_1 ${libname}-2_2
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
)
ENDMACRO(OPENEXR_FIND_VAR)
# Macro to find exr libraries (and debug versions)
# example: OPENEXR_FIND(IlmImf)
MACRO(OPENEXR_FIND libname)
OPENEXR_FIND_VAR(OPENEXR_${libname}_LIBRARY ${libname})
OPENEXR_FIND_VAR(OPENEXR_${libname}_LIBRARY_DEBUG ${libname}d)
ENDMACRO(OPENEXR_FIND)
OPENEXR_FIND(IlmImf)
SET(OPENEXR_FOUND "NO")
IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmImf_LIBRARY)
SET(OPENEXR_LIBRARIES ${OPENEXR_IlmImf_LIBRARY} )
SET(OPENEXR_LIBRARIES_VARS OPENEXR_IlmImf_LIBRARY )
SET(OPENEXR_FOUND "YES")
ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmImf_LIBRARY)