Skip to content

Build error with emscripten #1026

@JD31

Description

@JD31

Hello,
I am building zlib for several plarforms and have few issues.
In particular, the emscripten compiler (for doing WebAssembly from C++) does not support shared libraries, only static.
Then the following line in the cmake raises a warning:
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
because SHARED is not possible.
After the warning, CMake forces the lib to be built as STATIC instead of SHARED but then it creates another error stating that multiple targets generate the same object (because, at the end, the other line add_library(zlibstatic STATIC will generate the same) .
In my opinion, SHARED or STATIC should be a developer selection, or should be based on BUILD_SHARED_LIBS which is a standard CMake variable for this.
It is related to #575

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions