Fix MSVC Debug build with internal zlib
zlib sets CMAKE_DEBUG_POSTFIX to "d" with msvc in debug
@@ -220,12 +220,19 @@ if(OPENEXR_FORCE_INTERNAL_ZLIB OR NOT TARGET ZLIB::ZLIB)
set(zlibstaticlibname "z")
endif()
+ if(MSVC)
+ set(zlibpostfix "d")
+ endif()
+
if(NOT (APPLE OR WIN32) AND BUILD_SHARED_LIBS AND NOT OPENEXR_FORCE_INTERNAL_ZLIB)
add_library(zlib_shared SHARED IMPORTED GLOBAL)
add_dependencies(zlib_shared zlib_external)
set_property(TARGET zlib_shared PROPERTY
IMPORTED_LOCATION "${zlib_INTERNAL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${zliblibname}${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
+ set_property(TARGET zlib_static PROPERTY
+ IMPORTED_LOCATION_DEBUG "${zlib_INTERNAL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${zliblibname}${zlibpostfix}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+ )
target_include_directories(zlib_shared INTERFACE "${zlib_INTERNAL_DIR}/include")
endif()
@@ -234,6 +241,9 @@ if(OPENEXR_FORCE_INTERNAL_ZLIB OR NOT TARGET ZLIB::ZLIB)
set_property(TARGET zlib_static PROPERTY
IMPORTED_LOCATION "${zlib_INTERNAL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${zlibstaticlibname}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
+ set_property(TARGET zlib_static PROPERTY
+ IMPORTED_LOCATION_DEBUG "${zlib_INTERNAL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${zlibstaticlibname}${zlibpostfix}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+ )
target_include_directories(zlib_static INTERFACE "${zlib_INTERNAL_DIR}/include")
if(NOT (APPLE OR WIN32) AND BUILD_SHARED_LIBS AND NOT OPENEXR_FORCE_INTERNAL_ZLIB)
