Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2013-12-17 00:00:35 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-12-17 00:16:02 +0400
commit163df7ff43ec114a2ab5c7e0326670a18a11edc0 (patch)
tree060a0ab24adb0cb31721dc6222bf0a89a390b810 /build_files/cmake/Modules/FindOpenEXR.cmake
parentb78b3f2ac8e44f2120f2fe14cd2f976c50977bc0 (diff)
Better handling of new libnames of OpenEXR 2.1 (same solution as one used in OIIO/OSL source).
Diffstat (limited to 'build_files/cmake/Modules/FindOpenEXR.cmake')
-rw-r--r--build_files/cmake/Modules/FindOpenEXR.cmake56
1 files changed, 36 insertions, 20 deletions
diff --git a/build_files/cmake/Modules/FindOpenEXR.cmake b/build_files/cmake/Modules/FindOpenEXR.cmake
index 8fc2d572b62..dad96bccc9c 100644
--- a/build_files/cmake/Modules/FindOpenEXR.cmake
+++ b/build_files/cmake/Modules/FindOpenEXR.cmake
@@ -34,9 +34,42 @@ IF(NOT OPENEXR_ROOT_DIR AND NOT $ENV{OPENEXR_ROOT_DIR} STREQUAL "")
SET(OPENEXR_ROOT_DIR $ENV{OPENEXR_ROOT_DIR})
ENDIF()
-if (NOT OPENEXR_VERSION)
- SET(OPENEXR_VERSION "2.0.1")
-endif()
+SET(_openexr_SEARCH_DIRS
+ ${OPENEXR_ROOT_DIR}
+ /usr/local
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+)
+
+FIND_PATH(OPENEXR_INCLUDE_DIR
+ NAMES
+ OpenEXR/ImfXdr.h
+ HINTS
+ ${_openexr_SEARCH_DIRS}
+ PATH_SUFFIXES
+ include
+)
+
+# If the headers were found, get the version from config file, if not already set.
+if (OPENEXR_INCLUDE_DIR)
+ if (NOT OPENEXR_VERSION)
+ FILE(STRINGS "${OPENEXR_INCLUDE_DIR}/OpenEXR/OpenEXRConfig.h" OPENEXR_BUILD_SPECIFICATION
+ REGEX "^[ \t]*#define[ \t]+OPENEXR_VERSION_STRING[ \t]+\"[.0-9]+\".*$")
+
+ if(OPENEXR_BUILD_SPECIFICATION)
+ message(STATUS "${OPENEXR_BUILD_SPECIFICATION}")
+ string(REGEX REPLACE ".*#define[ \t]+OPENEXR_VERSION_STRING[ \t]+\"([.0-9]+)\".*"
+ "\\1" XYZ ${OPENEXR_BUILD_SPECIFICATION})
+ set("OPENEXR_VERSION" ${XYZ} CACHE STRING "Version of OpenEXR lib")
+ else()
+ # Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
+ message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
+ set("OPENEXR_VERSION" "2.0" CACHE STRING "Version of OpenEXR lib")
+ endif()
+ endif()
+endif ()
+
if (${OPENEXR_VERSION} VERSION_LESS "2.1")
SET(_openexr_FIND_COMPONENTS
Half
@@ -56,23 +89,6 @@ else ()
)
endif ()
-SET(_openexr_SEARCH_DIRS
- ${OPENEXR_ROOT_DIR}
- /usr/local
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
-)
-
-FIND_PATH(OPENEXR_INCLUDE_DIR
- NAMES
- OpenEXR/ImfXdr.h
- HINTS
- ${_openexr_SEARCH_DIRS}
- PATH_SUFFIXES
- include
-)
-
SET(_openexr_LIBRARIES)
FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)