cmake: find openexr release/debug separately and define them as such

Minor CMake improvement that becomes a major improvement on Windows,
because for some reason OpenEXR on Windows always crashes if you mix
release/debug builds (e.g. release OpenEXR + debug Olive and vice versa).
This ensures that as long as you have both release and debug (which you
will if you installed from vcpkg), CMake will link the correct lib and
prevent crashes.
This commit is contained in:
itsmattkc
2020-08-11 00:49:56 +10:00
parent 1b7badb85b
commit 43ad1d4368
+10 -2
View File
@@ -118,13 +118,21 @@ set (_openexr_components IlmThread IlmImf Imath Iex Half)
foreach (COMPONENT ${_openexr_components})
string (TOUPPER ${COMPONENT} UPPERCOMPONENT)
# First try with the version embedded
find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY
find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY_RELEASE
NAMES ${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}
${COMPONENT}
${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}_d
HINTS ${OPENEXR_LIBRARY_DIR} $ENV{OPENEXR_LIBRARY_DIR}
${GENERIC_LIBRARY_PATHS} )
find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY_DEBUG
NAMES ${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}_d
${COMPONENT}_d
HINTS ${OPENEXR_LIBRARY_DIR} $ENV{OPENEXR_LIBRARY_DIR}
${GENERIC_LIBRARY_PATHS} )
set(OPENEXR_${UPPERCOMPONENT}_LIBRARY
optimized ${OPENEXR_${UPPERCOMPONENT}_LIBRARY_RELEASE}
debug ${OPENEXR_${UPPERCOMPONENT}_LIBRARY_DEBUG})
endforeach ()
find_package_handle_standard_args (OpenEXR