diff --git a/CMakeLists.txt b/CMakeLists.txt index ce356c7b1..474d63b14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1680,7 +1680,8 @@ if (LWS_WITH_ZLIB) message("zlib/miniz include dirs: ${ZLIB_INCLUDE_DIRS}") message("zlib/miniz libraries: ${ZLIB_LIBRARIES}") include_directories(${ZLIB_INCLUDE_DIRS}) - list(APPEND LIB_LIST ${ZLIB_LIBRARIES}) + # done later at end of link list + # list(APPEND LIB_LIST ${ZLIB_LIBRARIES}) endif() if (LWS_WITH_HTTP_BROTLI) @@ -1846,6 +1847,10 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") list(APPEND LIB_LIST socket) endif() +# +# add libs here that need to be at the end of the link order +# + if (UNIX) list(APPEND LIB_LIST m) endif() @@ -1866,6 +1871,9 @@ if (UNIX) list(APPEND LIB_LIST dl) endif() +if (LWS_WITH_ZLIB AND NOT LWS_WITH_BUNDLED_ZLIB) + list(APPEND LIB_LIST "${ZLIB_LIBRARIES}") +endif() # Setup the linking for all libs. foreach (lib ${LWS_LIBRARIES})