IXWebSocket
IXWebSocket copied to clipboard
ZLib not set in Visual Studio linker settings
I have IXWebSocket v11.4.1 built locally from commit 6d8495bd73e739044. I am running Windows 10 Professional and Visual Studio 2022.
I have ZLib locally built in a location where find_package(ZLIB REQUIRED)
will not find it. I run cmake for IXWebSocket with the following options:
-DUSE_TLS=1 -DUSE_OPEN_SSL=1 -DUSE_ZLIB=1 -DZLIB_INCLUDE_DIR=<absolute-path-to-zlip-source-root>;<absolute-path-to-zlip-source-root>\build -DZLIB_LIBRARY=<absolute-path-to-zlibstatic.lib>
ZLib build process generates zconf.h in a different directory, therefore two separate include directories are needed. Without setting ZLIB_INCLUDE_DIR and ZLIB_LIBRARY, IXWebSocket cmake configuration would fail. However, those options do not seem to set the linker options to ZLib (zlibstatic.lib in this case) correctly in the ixwebsocket project in the generated Visual Studio solution. That will not fail the IXWebSocket build because IXWebSocket is just a library itself, but it will fail the build of the executable project linked against IXWebSocket later even if that project is also linked to ZLib (zlibstatic.lib in this case). The workaround is to fix the linker settings in ixwebsocket before building it, but that should not need to be done manually but automatically by cmake.
Note that I also tried setting ZLIB_ROOT for cmake instead of ZLIB_INCLUDE_DIR and ZLIB_LIBRARY, but that did not make any difference in regards to the generated linker settings.
Is there anything I'm doing wrong here or should IXWebSocket's CMakeLists.txt be fixed/improved?