Skip to content

Windows: Can't link a project to OpenEXR that was built with static zlib #871

Open
@ignus2

Description

@ignus2

Branch: master (f04fcdd)

Trying to use a Windows build of OpenEXR built with built-in zlib fails at first with the following error at CMake time:

Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
...
... /openexr/lib/cmake/OpenEXR/OpenEXRConfig.cmake:31 (find_dependency)

This is due to find_dependency(ZLIB REQUIRED) in OpenEXRConfig.cmake:31.
If I manually comment out that line, CMake succeeds, but now I get a linker error:

LINK : fatal error LNK1181: cannot open input file 'zlib_static.lib'

This is due to zlib_static being present in the INTERFACE_LINK_LIBRARIES of OpenEXR::OpenEXR
If I also manually remove zlib_static (from OpenEXRTargets.cmake) then my program all builds and runs fine.

I believe if OpenEXR is built with internal static zlib library, then zlib should not appear as a dependency and neither at the interface link libraries.

Metadata

Metadata

Assignees

Labels

BuildA problem with building or installing the library.Windows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions