diff --git a/CMakeLists.txt b/CMakeLists.txt index 091b25c0..b654112e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,6 +138,11 @@ if (APPLE AND USE_TLS AND NOT USE_MBED_TLS) target_link_libraries(ixwebsocket "-framework foundation" "-framework security") endif() +if (WIN32) + target_link_libraries(ixwebsocket wsock32 ws2_32) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif() + if (UNIX) find_package(Threads) target_link_libraries(ixwebsocket ${CMAKE_THREAD_LIBS_INIT}) @@ -165,15 +170,14 @@ if (USE_TLS AND USE_MBED_TLS) endif() endif() -find_package(ZLIB REQUIRED) +find_package(ZLIB) if (ZLIB_FOUND) include_directories(${ZLIB_INCLUDE_DIRS}) target_link_libraries(ixwebsocket ${ZLIB_LIBRARIES}) else() add_subdirectory(third_party/zlib) include_directories(third_party/zlib ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib) - target_link_libraries(ixwebsocket zlibstatic wsock32 ws2_32) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) + target_link_libraries(ixwebsocket zlibstatic) endif() set( IXWEBSOCKET_INCLUDE_DIRS