-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Provide method to find user-installed OpenEXR #13403
Description
System information (version)
- OpenCV => 2.4+ (All versions since 2012)
- Operating System / Platform => Debian 64 Bit
- Compiler => GCC 6
Detailed description
Background
I found this issue while trying to use the Conan package manager. I realise that the OpenCV does not provide any official package manager support, but I believe this fix could help others too. https://github.com/conan-community/community/issues/114
Description
In the FindOpenEXR.cmake file (https://github.com/opencv/opencv/blob/master/cmake/OpenCVFindOpenEXR.cmake), there is support for using a variable called 'OPENEXR_ROOT' to find a version of OpenEXR installed in a user-defined location. Currently this is a cache variable with a default of C:\Deploy and is only defined/useable in Windows:
if(WIN32)
SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder")
if(CMAKE_CL_64)
SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug)
elseif(MSVC)
SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug)
endif()
else()
set(OPENEXR_ROOT "")
endif()It would be great if it could also be a cache variable for other platforms, we can keep the default to "", as it is being set to now.
The second thing that would be required is to change the following blob:
SET(LIBRARY_PATHS
/usr/lib
/usr/local/lib
/sw/lib
/opt/local/lib
"${ProgramFiles_ENV_PATH}/OpenEXR/lib/static"
"${OPENEXR_ROOT}/lib")to
SET(LIBRARY_PATHS
"${OPENEXR_ROOT}/lib"
/usr/lib
/usr/local/lib
/sw/lib
/opt/local/lib
"${ProgramFiles_ENV_PATH}/OpenEXR/lib/static")i.e. if we explicitly define OPENEXR_ROOT then we would expect to search that location first before any system installed versions. This is in particular important for use with package managers (which is where I ran into the problem).
If there are problems using that OPENEXR_ROOT for whatever reason, maybe it would be OK to use a new variable instead e.g. OPENEXR_USER_ROOT, which could default?