diff options
Diffstat (limited to 'build_files/build_environment')
-rw-r--r-- | build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake | 206 | ||||
-rw-r--r-- | build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake | 186 |
2 files changed, 199 insertions, 193 deletions
diff --git a/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake b/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake index f1a45228128..de4c0aba48c 100644 --- a/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake +++ b/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake @@ -21,9 +21,9 @@ # ILMBASE_FOUND - True if IlmBase was found. # Other standarnd issue macros -include (FindPackageHandleStandardArgs) -include (FindPackageMessage) -include (SelectLibraryConfigurations) +include(FindPackageHandleStandardArgs) +include(FindPackageMessage) +include(SelectLibraryConfigurations) if( ILMBASE_USE_STATIC_LIBS ) @@ -36,42 +36,42 @@ if( ILMBASE_USE_STATIC_LIBS ) endif() # Macro to assemble a helper state variable -macro (SET_STATE_VAR varname) - set (tmp_ilmbaselibs ${ILMBASE_CUSTOM_LIBRARIES}) - separate_arguments (tmp_ilmbaselibs) - set (tmp_lst +macro(SET_STATE_VAR varname) + set(tmp_ilmbaselibs ${ILMBASE_CUSTOM_LIBRARIES}) + separate_arguments(tmp_ilmbaselibs) + set(tmp_lst ${ILMBASE_CUSTOM} | ${tmp_ilmbaselibs} | ${ILMBASE_HOME} | ${ILMBASE_VERSION} | ${ILMBASE_LIB_AREA} ) - set (${varname} "${tmp_lst}") - unset (tmp_ilmbaselibs) - unset (tmp_lst) -endmacro () + set(${varname} "${tmp_lst}") + unset(tmp_ilmbaselibs) + unset(tmp_lst) +endmacro() # To enforce that find_* functions do not use inadvertently existing versions -if (ILMBASE_CUSTOM) - set (ILMBASE_FIND_OPTIONS "NO_DEFAULT_PATH") -endif () +if(ILMBASE_CUSTOM) + set(ILMBASE_FIND_OPTIONS "NO_DEFAULT_PATH") +endif() # Macro to search for an include directory -macro (PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var) - string (TOUPPER ${prefix}_INCLUDE_DIR tmp_varname) +macro(PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var) + string(TOUPPER ${prefix}_INCLUDE_DIR tmp_varname) find_path(${tmp_varname} ${includefile} HINTS ${${libpath_var}} PATH_SUFFIXES include ${ILMBASE_FIND_OPTIONS} ) - if (${tmp_varname}) - mark_as_advanced (${tmp_varname}) - endif () - unset (tmp_varname) -endmacro () + if(${tmp_varname}) + mark_as_advanced(${tmp_varname}) + endif() + unset(tmp_varname) +endmacro() # Macro to search for the given library and adds the cached # variable names to the specified list -macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var) - string (TOUPPER ${prefix}_${libname} tmp_prefix) +macro(PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var) + string(TOUPPER ${prefix}_${libname} tmp_prefix) # Handle new library names for OpenEXR 2.1 build via cmake string(REPLACE "." "_" _ILMBASE_VERSION ${ILMBASE_VERSION}) string(SUBSTRING ${_ILMBASE_VERSION} 0 3 _ILMBASE_VERSION ) @@ -89,86 +89,90 @@ macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var) ${ILMBASE_FIND_OPTIONS} ) # Properly define ${tmp_prefix}_LIBRARY (cached) and ${tmp_prefix}_LIBRARIES - select_library_configurations (${tmp_prefix}) - list (APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES) + select_library_configurations(${tmp_prefix}) + list(APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES) # Add to the list of variables which should be reset - list (APPEND ${cachelist_var} + list(APPEND ${cachelist_var} ${tmp_prefix}_LIBRARY ${tmp_prefix}_LIBRARY_RELEASE ${tmp_prefix}_LIBRARY_DEBUG) - mark_as_advanced ( + mark_as_advanced( ${tmp_prefix}_LIBRARY ${tmp_prefix}_LIBRARY_RELEASE ${tmp_prefix}_LIBRARY_DEBUG) - unset (tmp_prefix) -endmacro () + unset(tmp_prefix) +endmacro() # Encode the current state of the external variables into a string -SET_STATE_VAR (ILMBASE_CURRENT_STATE) +SET_STATE_VAR(ILMBASE_CURRENT_STATE) # If the state has changed, clear the cached variables -if (ILMBASE_CACHED_STATE AND +if(ILMBASE_CACHED_STATE AND NOT ILMBASE_CACHED_STATE STREQUAL ILMBASE_CURRENT_STATE) - foreach (libvar ${ILMBASE_CACHED_VARS}) - unset (${libvar} CACHE) - endforeach () -endif () + foreach(libvar ${ILMBASE_CACHED_VARS}) + unset(${libvar} CACHE) + endforeach() +endif() # Generic search paths -set (IlmBase_generic_include_paths +set(IlmBase_generic_include_paths ${ILMBASE_CUSTOM_INCLUDE_DIR} /usr/include /usr/include/${CMAKE_LIBRARY_ARCHITECTURE} /usr/local/include /sw/include - /opt/local/include) -set (IlmBase_generic_library_paths + /opt/local/include +) +set(IlmBase_generic_library_paths ${ILMBASE_CUSTOM_LIB_DIR} /usr/lib /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} /usr/local/lib /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} /sw/lib - /opt/local/lib) + /opt/local/lib +) # Search paths for the IlmBase files -if (ILMBASE_HOME) - if (ILMBASE_VERSION) - set (IlmBase_include_paths +if(ILMBASE_HOME) + if(ILMBASE_VERSION) + set(IlmBase_include_paths ${ILMBASE_HOME}/ilmbase-${ILMBASE_VERSION}/include - ${ILMBASE_HOME}/include/ilmbase-${ILMBASE_VERSION}) - set (IlmBase_library_paths + ${ILMBASE_HOME}/include/ilmbase-${ILMBASE_VERSION} + ) + set(IlmBase_library_paths ${ILMBASE_HOME}/ilmbase-${ILMBASE_VERSION}/lib - ${ILMBASE_HOME}/lib/ilmbase-${ILMBASE_VERSION}) + ${ILMBASE_HOME}/lib/ilmbase-${ILMBASE_VERSION} + ) endif() - list (APPEND IlmBase_include_paths ${ILMBASE_HOME}/include) - set (IlmBase_library_paths + list(APPEND IlmBase_include_paths ${ILMBASE_HOME}/include) + set(IlmBase_library_paths ${ILMBASE_HOME}/lib ${ILMBASE_HOME}/lib64 ${ILMBASE_LIB_AREA} ${IlmBase_library_paths}) -endif () -list (APPEND IlmBase_include_paths ${IlmBase_generic_include_paths}) -list (APPEND IlmBase_library_paths ${IlmBase_generic_library_paths}) +endif() +list(APPEND IlmBase_include_paths ${IlmBase_generic_include_paths}) +list(APPEND IlmBase_library_paths ${IlmBase_generic_library_paths}) # Locate the header files -PREFIX_FIND_INCLUDE_DIR (IlmBase +PREFIX_FIND_INCLUDE_DIR(IlmBase OpenEXR/IlmBaseConfig.h IlmBase_include_paths) -if (ILMBASE_INCLUDE_DIR) +if(ILMBASE_INCLUDE_DIR) # Get the version from config file, if not already set. - if (NOT ILMBASE_VERSION) + if(NOT ILMBASE_VERSION) FILE(STRINGS "${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h" ILMBASE_BUILD_SPECIFICATION REGEX "^[ \t]*#define[ \t]+ILMBASE_VERSION_STRING[ \t]+\"[.0-9]+\".*$") if(ILMBASE_BUILD_SPECIFICATION) - if (NOT IlmBase_FIND_QUIETLY) + if(NOT IlmBase_FIND_QUIETLY) message(STATUS "${ILMBASE_BUILD_SPECIFICATION}") - endif () + endif() string(REGEX REPLACE ".*#define[ \t]+ILMBASE_VERSION_STRING[ \t]+\"([.0-9]+)\".*" "\\1" XYZ ${ILMBASE_BUILD_SPECIFICATION}) set("ILMBASE_VERSION" ${XYZ} CACHE STRING "Version of ILMBase lib") @@ -178,71 +182,71 @@ if (ILMBASE_INCLUDE_DIR) set("ILMBASE_VERSION" "2.0" CACHE STRING "Version of ILMBase lib") endif() endif() -endif () +endif() -if (ILMBASE_CUSTOM) - if (NOT ILMBASE_CUSTOM_LIBRARIES) - message (FATAL_ERROR "Custom IlmBase libraries requested but ILMBASE_CUSTOM_LIBRARIES is not set.") +if(ILMBASE_CUSTOM) + if(NOT ILMBASE_CUSTOM_LIBRARIES) + message(FATAL_ERROR "Custom IlmBase libraries requested but ILMBASE_CUSTOM_LIBRARIES is not set.") endif() - set (IlmBase_Libraries ${ILMBASE_CUSTOM_LIBRARIES}) + set(IlmBase_Libraries ${ILMBASE_CUSTOM_LIBRARIES}) separate_arguments(IlmBase_Libraries) -else () -#elseif (${ILMBASE_VERSION} VERSION_LESS "2.1") - set (IlmBase_Libraries Half Iex Imath IlmThread) -#else () +else() +#elseif(${ILMBASE_VERSION} VERSION_LESS "2.1") + set(IlmBase_Libraries Half Iex Imath IlmThread) +#else() # string(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _ilmbase_libs_ver ${ILMBASE_VERSION}) -# set (IlmBase_Libraries Half Iex-${_ilmbase_libs_ver} Imath-${_ilmbase_libs_ver} IlmThread-${_ilmbase_libs_ver}) -endif () +# set(IlmBase_Libraries Half Iex-${_ilmbase_libs_ver} Imath-${_ilmbase_libs_ver} IlmThread-${_ilmbase_libs_ver}) +endif() # Locate the IlmBase libraries -set (IlmBase_libvars "") -set (IlmBase_cachevars "") -foreach (ilmbase_lib ${IlmBase_Libraries}) - PREFIX_FIND_LIB (IlmBase ${ilmbase_lib} +set(IlmBase_libvars "") +set(IlmBase_cachevars "") +foreach(ilmbase_lib ${IlmBase_Libraries}) + PREFIX_FIND_LIB(IlmBase ${ilmbase_lib} IlmBase_library_paths IlmBase_libvars IlmBase_cachevars) -endforeach () +endforeach() # Create the list of variables that might need to be cleared -set (ILMBASE_CACHED_VARS +set(ILMBASE_CACHED_VARS ILMBASE_INCLUDE_DIR ${IlmBase_cachevars} CACHE INTERNAL "Variables set by FindIlmBase.cmake" FORCE) # Store the current state so that variables might be cleared if required -set (ILMBASE_CACHED_STATE ${ILMBASE_CURRENT_STATE} +set(ILMBASE_CACHED_STATE ${ILMBASE_CURRENT_STATE} CACHE INTERNAL "State last seen by FindIlmBase.cmake" FORCE) # Link with pthreads if required -if (NOT WIN32 AND EXISTS ${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h) - file (STRINGS ${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h +if(NOT WIN32 AND EXISTS ${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h) + file(STRINGS ${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h ILMBASE_HAVE_PTHREAD REGEX "^[ \\t]*#define[ \\t]+HAVE_PTHREAD[ \\t]1[ \\t]*\$" ) - if (ILMBASE_HAVE_PTHREAD) - find_package (Threads) - if (CMAKE_USE_PTHREADS_INIT) - set (ILMBASE_PTHREADS ${CMAKE_THREAD_LIBS_INIT}) - endif () - endif () -endif () + if(ILMBASE_HAVE_PTHREAD) + find_package(Threads) + if(CMAKE_USE_PTHREADS_INIT) + set(ILMBASE_PTHREADS ${CMAKE_THREAD_LIBS_INIT}) + endif() + endif() +endif() # Use the standard function to handle ILMBASE_FOUND -FIND_PACKAGE_HANDLE_STANDARD_ARGS (IlmBase DEFAULT_MSG +FIND_PACKAGE_HANDLE_STANDARD_ARGS(IlmBase DEFAULT_MSG ILMBASE_INCLUDE_DIR ${IlmBase_libvars}) -if (ILMBASE_FOUND) - set (ILMBASE_LIBRARIES "") - foreach (tmplib ${IlmBase_libvars}) - list (APPEND ILMBASE_LIBRARIES ${${tmplib}}) - endforeach () - list (APPEND ILMBASE_LIBRARIES ${ILMBASE_PTHREADS}) - if (NOT IlmBase_FIND_QUIETLY) - FIND_PACKAGE_MESSAGE (ILMBASE +if(ILMBASE_FOUND) + set(ILMBASE_LIBRARIES "") + foreach(tmplib ${IlmBase_libvars}) + list(APPEND ILMBASE_LIBRARIES ${${tmplib}}) + endforeach() + list(APPEND ILMBASE_LIBRARIES ${ILMBASE_PTHREADS}) + if(NOT IlmBase_FIND_QUIETLY) + FIND_PACKAGE_MESSAGE(ILMBASE "Found IlmBase: ${ILMBASE_LIBRARIES}" "[${ILMBASE_INCLUDE_DIR}][${ILMBASE_LIBRARIES}][${ILMBASE_CURRENT_STATE}]" ) - endif () -endif () + endif() +endif() # Restore the original find library ordering if( ILMBASE_USE_STATIC_LIBS ) @@ -250,11 +254,11 @@ if( ILMBASE_USE_STATIC_LIBS ) endif() # Unset the helper variables to avoid pollution -unset (ILMBASE_CURRENT_STATE) -unset (IlmBase_include_paths) -unset (IlmBase_library_paths) -unset (IlmBase_generic_include_paths) -unset (IlmBase_generic_library_paths) -unset (IlmBase_libvars) -unset (IlmBase_cachevars) -unset (ILMBASE_PTHREADS) +unset(ILMBASE_CURRENT_STATE) +unset(IlmBase_include_paths) +unset(IlmBase_library_paths) +unset(IlmBase_generic_include_paths) +unset(IlmBase_generic_library_paths) +unset(IlmBase_libvars) +unset(IlmBase_cachevars) +unset(ILMBASE_PTHREADS) diff --git a/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake b/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake index 08d872445d7..1eb4ea3f5e7 100644 --- a/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake +++ b/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake @@ -23,12 +23,12 @@ # OPENEXR_FOUND - True if OpenEXR was found. # Other standarnd issue macros -include (SelectLibraryConfigurations) -include (FindPackageHandleStandardArgs) -include (FindPackageMessage) +include(SelectLibraryConfigurations) +include(FindPackageHandleStandardArgs) +include(FindPackageMessage) -if( OPENEXR_USE_STATIC_LIBS ) - set( _openexr_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) +if(OPENEXR_USE_STATIC_LIBS) + set(_openexr_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) if(WIN32) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) else() @@ -37,39 +37,39 @@ if( OPENEXR_USE_STATIC_LIBS ) endif() # Macro to assemble a helper state variable -macro (SET_STATE_VAR varname) - set (tmp_lst +macro(SET_STATE_VAR varname) + set(tmp_lst ${OPENEXR_CUSTOM} | ${OPENEXR_CUSTOM_LIBRARY} | ${OPENEXR_HOME} | ${OPENEXR_VERSION} | ${OPENEXR_LIB_AREA} ) - set (${varname} "${tmp_lst}") - unset (tmp_lst) -endmacro () + set(${varname} "${tmp_lst}") + unset(tmp_lst) +endmacro() # To enforce that find_* functions do not use inadvertently existing versions -if (OPENEXR_CUSTOM) - set (OPENEXR_FIND_OPTIONS "NO_DEFAULT_PATH") -endif () +if(OPENEXR_CUSTOM) + set(OPENEXR_FIND_OPTIONS "NO_DEFAULT_PATH") +endif() # Macro to search for an include directory -macro (PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var) - string (TOUPPER ${prefix}_INCLUDE_DIR tmp_varname) +macro(PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var) + string(TOUPPER ${prefix}_INCLUDE_DIR tmp_varname) find_path(${tmp_varname} ${includefile} HINTS ${${libpath_var}} PATH_SUFFIXES include ${OPENEXR_FIND_OPTIONS} ) - if (${tmp_varname}) - mark_as_advanced (${tmp_varname}) - endif () - unset (tmp_varname) -endmacro () + if(${tmp_varname}) + mark_as_advanced(${tmp_varname}) + endif() + unset(tmp_varname) +endmacro() # Macro to search for the given library and adds the cached # variable names to the specified list -macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var) - string (TOUPPER ${prefix}_${libname} tmp_prefix) +macro(PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var) + string(TOUPPER ${prefix}_${libname} tmp_prefix) # Handle new library names for OpenEXR 2.1 build via cmake string(REPLACE "." "_" _ILMBASE_VERSION ${ILMBASE_VERSION}) string(SUBSTRING ${_ILMBASE_VERSION} 0 3 _ILMBASE_VERSION ) @@ -86,89 +86,91 @@ macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var) ${OPENEXR_FIND_OPTIONS} ) # Properly define ${tmp_prefix}_LIBRARY (cached) and ${tmp_prefix}_LIBRARIES - select_library_configurations (${tmp_prefix}) - list (APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES) + select_library_configurations(${tmp_prefix}) + list(APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES) # Add to the list of variables which should be reset - list (APPEND ${cachelist_var} + list(APPEND ${cachelist_var} ${tmp_prefix}_LIBRARY ${tmp_prefix}_LIBRARY_RELEASE ${tmp_prefix}_LIBRARY_DEBUG) - mark_as_advanced ( + mark_as_advanced( ${tmp_prefix}_LIBRARY ${tmp_prefix}_LIBRARY_RELEASE ${tmp_prefix}_LIBRARY_DEBUG) - unset (tmp_prefix) -endmacro () + unset(tmp_prefix) +endmacro() # Encode the current state of the external variables into a string -SET_STATE_VAR (OPENEXR_CURRENT_STATE) +SET_STATE_VAR(OPENEXR_CURRENT_STATE) # If the state has changed, clear the cached variables -if (OPENEXR_CACHED_STATE AND +if(OPENEXR_CACHED_STATE AND NOT OPENEXR_CACHED_STATE STREQUAL OPENEXR_CURRENT_STATE) - foreach (libvar ${OPENEXR_CACHED_VARS}) - unset (${libvar} CACHE) - endforeach () -endif () + foreach(libvar ${OPENEXR_CACHED_VARS}) + unset(${libvar} CACHE) + endforeach() +endif() # Generic search paths -set (OpenEXR_generic_include_paths +set(OpenEXR_generic_include_paths ${OPENEXR_CUSTOM_INCLUDE_DIR} /usr/include /usr/include/${CMAKE_LIBRARY_ARCHITECTURE} /usr/local/include /sw/include - /opt/local/include) -set (OpenEXR_generic_library_paths + /opt/local/include +) +set(OpenEXR_generic_library_paths ${OPENEXR_CUSTOM_LIB_DIR} /usr/lib /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} /usr/local/lib /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} /sw/lib - /opt/local/lib) + /opt/local/lib +) # Search paths for the OpenEXR files -if (OPENEXR_HOME) - set (OpenEXR_library_paths +if(OPENEXR_HOME) + set(OpenEXR_library_paths ${OPENEXR_HOME}/lib ${OPENEXR_HOME}/lib64) - if (OPENEXR_VERSION) - set (OpenEXR_include_paths + if(OPENEXR_VERSION) + set(OpenEXR_include_paths ${OPENEXR_HOME}/openexr-${OPENEXR_VERSION}/include ${OPENEXR_HOME}/include/openexr-${OPENEXR_VERSION}) - list (APPEND OpenEXR_library_paths + list(APPEND OpenEXR_library_paths ${OPENEXR_HOME}/openexr-${OPENEXR_VERSION}/lib ${OPENEXR_HOME}/lib/openexr-${OPENEXR_VERSION}) endif() - list (APPEND OpenEXR_include_paths ${OPENEXR_HOME}/include) - if (OPENEXR_LIB_AREA) - list (INSERT OpenEXR_library_paths 2 ${OPENEXR_LIB_AREA}) - endif () -endif () -if (ILMBASE_HOME AND OPENEXR_VERSION) - list (APPEND OpenEXR_include_paths + list(APPEND OpenEXR_include_paths ${OPENEXR_HOME}/include) + if(OPENEXR_LIB_AREA) + list(INSERT OpenEXR_library_paths 2 ${OPENEXR_LIB_AREA}) + endif() +endif() +if(ILMBASE_HOME AND OPENEXR_VERSION) + list(APPEND OpenEXR_include_paths ${ILMBASE_HOME}/include/openexr-${OPENEXR_VERSION}) endif() -list (APPEND OpenEXR_include_paths ${OpenEXR_generic_include_paths}) -list (APPEND OpenEXR_library_paths ${OpenEXR_generic_library_paths}) +list(APPEND OpenEXR_include_paths ${OpenEXR_generic_include_paths}) +list(APPEND OpenEXR_library_paths ${OpenEXR_generic_library_paths}) # Locate the header files -PREFIX_FIND_INCLUDE_DIR (OpenEXR +PREFIX_FIND_INCLUDE_DIR(OpenEXR OpenEXR/ImfArray.h OpenEXR_include_paths) -if (OPENEXR_INCLUDE_DIR) +if(OPENEXR_INCLUDE_DIR) # Get the version from config file, if not already set. - if (NOT OPENEXR_VERSION) + 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) - if (NOT OpenEXR_FIND_QUIETLY) + if(NOT OpenEXR_FIND_QUIETLY) message(STATUS "${OPENEXR_BUILD_SPECIFICATION}") - endif () + endif() 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") @@ -178,56 +180,56 @@ if (OPENEXR_INCLUDE_DIR) set("OPENEXR_VERSION" "2.0" CACHE STRING "Version of OpenEXR lib") endif() endif() -endif () +endif() -if (OPENEXR_CUSTOM) - if (NOT OPENEXR_CUSTOM_LIBRARY) - message (FATAL_ERROR "Custom OpenEXR library requested but OPENEXR_CUSTOM_LIBRARY is not set.") +if(OPENEXR_CUSTOM) + if(NOT OPENEXR_CUSTOM_LIBRARY) + message(FATAL_ERROR "Custom OpenEXR library requested but OPENEXR_CUSTOM_LIBRARY is not set.") endif() - set (OpenEXR_Library ${OPENEXR_CUSTOM_LIBRARY}) -else () -#elseif (${OPENEXR_VERSION} VERSION_LESS "2.1") - set (OpenEXR_Library IlmImf) -#else () + set(OpenEXR_Library ${OPENEXR_CUSTOM_LIBRARY}) +else() +#elseif(${OPENEXR_VERSION} VERSION_LESS "2.1") + set(OpenEXR_Library IlmImf) +#else() # string(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _openexr_libs_ver ${OPENEXR_VERSION}) -# set (OpenEXR_Library IlmImf-${_openexr_libs_ver}) -endif () +# set(OpenEXR_Library IlmImf-${_openexr_libs_ver}) +endif() # Locate the OpenEXR library -set (OpenEXR_libvars "") -set (OpenEXR_cachevars "") -PREFIX_FIND_LIB (OpenEXR ${OpenEXR_Library} +set(OpenEXR_libvars "") +set(OpenEXR_cachevars "") +PREFIX_FIND_LIB(OpenEXR ${OpenEXR_Library} OpenEXR_library_paths OpenEXR_libvars OpenEXR_cachevars) # Create the list of variables that might need to be cleared -set (OPENEXR_CACHED_VARS +set(OPENEXR_CACHED_VARS OPENEXR_INCLUDE_DIR ${OpenEXR_cachevars} CACHE INTERNAL "Variables set by FindOpenEXR.cmake" FORCE) # Store the current state so that variables might be cleared if required -set (OPENEXR_CACHED_STATE ${OPENEXR_CURRENT_STATE} +set(OPENEXR_CACHED_STATE ${OPENEXR_CURRENT_STATE} CACHE INTERNAL "State last seen by FindOpenEXR.cmake" FORCE) # Always link explicitly with zlib -set (OPENEXR_ZLIB ${ZLIB_LIBRARIES}) +set(OPENEXR_ZLIB ${ZLIB_LIBRARIES}) # Use the standard function to handle OPENEXR_FOUND -FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenEXR DEFAULT_MSG +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG OPENEXR_INCLUDE_DIR ${OpenEXR_libvars}) -if (OPENEXR_FOUND) - set (OPENEXR_LIBRARIES "") - foreach (tmplib ${OpenEXR_libvars}) - list (APPEND OPENEXR_LIBRARIES ${${tmplib}}) - endforeach () - list (APPEND OPENEXR_LIBRARIES ${ZLIB_LIBRARIES}) - if (NOT OpenEXR_FIND_QUIETLY) - FIND_PACKAGE_MESSAGE (OPENEXR +if(OPENEXR_FOUND) + set(OPENEXR_LIBRARIES "") + foreach(tmplib ${OpenEXR_libvars}) + list(APPEND OPENEXR_LIBRARIES ${${tmplib}}) + endforeach() + list(APPEND OPENEXR_LIBRARIES ${ZLIB_LIBRARIES}) + if(NOT OpenEXR_FIND_QUIETLY) + FIND_PACKAGE_MESSAGE(OPENEXR "Found OpenEXR: ${OPENEXR_LIBRARIES}" "[${OPENEXR_INCLUDE_DIR}][${OPENEXR_LIBRARIES}][${OPENEXR_CURRENT_STATE}]" ) - endif () -endif () + endif() +endif() # Restore the original find library ordering if( OPENEXR_USE_STATIC_LIBS ) @@ -235,10 +237,10 @@ if( OPENEXR_USE_STATIC_LIBS ) endif() # Unset the helper variables to avoid pollution -unset (OPENEXR_CURRENT_STATE) -unset (OpenEXR_include_paths) -unset (OpenEXR_library_paths) -unset (OpenEXR_generic_include_paths) -unset (OpenEXR_generic_library_paths) -unset (OpenEXR_libvars) -unset (OpenEXR_cachevars) +unset(OPENEXR_CURRENT_STATE) +unset(OpenEXR_include_paths) +unset(OpenEXR_library_paths) +unset(OpenEXR_generic_include_paths) +unset(OpenEXR_generic_library_paths) +unset(OpenEXR_libvars) +unset(OpenEXR_cachevars) |