]> prime8.dev >> repos - ttyd.git/commitdiff
cmake: find libwebsockts manually
authorShuanglei Tao <tsl0922@gmail.com>
Sun, 28 Mar 2021 04:18:18 +0000 (12:18 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Sun, 28 Mar 2021 04:43:38 +0000 (12:43 +0800)
CMakeLists.txt

index ae5915eb5f2f7c7cbc6b476d50ea413c9e8bbea7..0da04eea43f8b49678edbcd096c007eb06977df9 100644 (file)
@@ -17,7 +17,7 @@ if(GIT_FOUND)
     endif()
 endif()
 
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -Wvla")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
 if(CMAKE_VERSION VERSION_LESS "3.1")
     if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
@@ -43,7 +43,7 @@ endif()
 
 find_path(JSON-C_INCLUDE_DIR NAMES json.h PATH_SUFFIXES json-c)
 find_library(JSON-C_LIBRARY NAMES json-c)
-find_package_handle_standard_args(JSON-C REQUIRED_VARS JSON-C_INCLUDE_DIR JSON-C_LIBRARY)
+find_package_handle_standard_args(JSON-C REQUIRED_VARS JSON-C_LIBRARY JSON-C_INCLUDE_DIR)
 mark_as_advanced(JSON-C_INCLUDE_DIR JSON-C_LIBRARY)
 if(JSON-C_FOUND)
     SET(JSON-C_INCLUDE_DIRS "${JSON-C_INCLUDE_DIR}")
@@ -56,9 +56,9 @@ find_package(Libwebsockets 1.7.0 QUIET)
 if(NOT Libwebsockets_FOUND) # for libwebsockets-dev on ubuntu 16.04
     find_path(LIBWEBSOCKETS_INCLUDE_DIR NAMES libwebsockets.h)
     find_library(LIBWEBSOCKETS_LIBRARY NAMES websockets)
-    find_package_handle_standard_args(Libwebsockets REQUIRED_VARS LIBWEBSOCKETS_LIBRARY LIBWEBSOCKETS_INCLUDE_DIR)
+    find_package_handle_standard_args(LIBWEBSOCKETS REQUIRED_VARS LIBWEBSOCKETS_LIBRARY LIBWEBSOCKETS_INCLUDE_DIR)
     mark_as_advanced(LIBWEBSOCKETS_INCLUDE_DIR LIBWEBSOCKETS_LIBRARY)
-    if(Libwebsockets_FOUND)
+    if(LIBWEBSOCKETS_FOUND)
         SET(LIBWEBSOCKETS_INCLUDE_DIRS "${LIBWEBSOCKETS_INCLUDE_DIR}")
         SET(LIBWEBSOCKETS_LIBRARIES "${LIBWEBSOCKETS_LIBRARY}")
     endif()
@@ -78,7 +78,7 @@ if(LWS_OPENSSL_ENABLED AND NOT LWS_MBEDTLS_ENABLED)
 endif()
 
 if(WIN32)
-    list(APPEND LINK_LIBS shell32)
+    list(APPEND LINK_LIBS shell32 ws2_32)
 elseif(NOT APPLE)
     list(APPEND LINK_LIBS util)
 endif()