CMake: Fix libname handling of OpenEXR 2.1. The library built with Autotools was not found.
Weird library names having version suffix (e.g. libIex-2_1.so) are used only when the OpenEXR was built with CMake. Building the library with the Autotools doesn't add the version suffix.
This commit is contained in:
@@ -34,6 +34,14 @@ IF(NOT OPENEXR_ROOT_DIR AND NOT $ENV{OPENEXR_ROOT_DIR} STREQUAL "")
|
||||
SET(OPENEXR_ROOT_DIR $ENV{OPENEXR_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_openexr_FIND_COMPONENTS
|
||||
Half
|
||||
Iex
|
||||
IlmImf
|
||||
IlmThread
|
||||
Imath
|
||||
)
|
||||
|
||||
SET(_openexr_SEARCH_DIRS
|
||||
${OPENEXR_ROOT_DIR}
|
||||
/usr/local
|
||||
@@ -87,24 +95,7 @@ IF(OPENEXR_INCLUDE_DIR)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(${OPENEXR_VERSION} VERSION_LESS "2.1")
|
||||
SET(_openexr_FIND_COMPONENTS
|
||||
Half
|
||||
Iex
|
||||
IlmImf
|
||||
IlmThread
|
||||
Imath
|
||||
)
|
||||
ELSE()
|
||||
STRING(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _openexr_libs_ver ${OPENEXR_VERSION})
|
||||
SET(_openexr_FIND_COMPONENTS
|
||||
Half
|
||||
Iex-${_openexr_libs_ver}
|
||||
IlmImf-${_openexr_libs_ver}
|
||||
IlmThread-${_openexr_libs_ver}
|
||||
Imath-${_openexr_libs_ver}
|
||||
)
|
||||
ENDIF()
|
||||
STRING(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _openexr_libs_ver ${OPENEXR_VERSION})
|
||||
|
||||
SET(_openexr_LIBRARIES)
|
||||
FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
|
||||
@@ -112,7 +103,7 @@ FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
|
||||
|
||||
FIND_LIBRARY(OPENEXR_${UPPERCOMPONENT}_LIBRARY
|
||||
NAMES
|
||||
${COMPONENT}
|
||||
${COMPONENT} ${COMPONENT}-${_openexr_libs_ver}
|
||||
HINTS
|
||||
${_openexr_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
@@ -121,6 +112,8 @@ FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
|
||||
LIST(APPEND _openexr_LIBRARIES "${OPENEXR_${UPPERCOMPONENT}_LIBRARY}")
|
||||
ENDFOREACH()
|
||||
|
||||
UNSET(_openexr_libs_ver)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
Reference in New Issue
Block a user