1# 2# libwebsockets - small server side websockets and web server implementation 3# 4# Copyright (C) 2010 - 2020 Andy Green <andy@warmcat.com> 5# 6# Permission is hereby granted, free of charge, to any person obtaining a copy 7# of this software and associated documentation files (the "Software"), to 8# deal in the Software without restriction, including without limitation the 9# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10# sell copies of the Software, and to permit persons to whom the Software is 11# furnished to do so, subject to the following conditions: 12# 13# The above copyright notice and this permission notice shall be included in 14# all copies or substantial portions of the Software. 15# 16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22# IN THE SOFTWARE. 23# 24# The strategy is to only export to PARENT_SCOPE 25# 26# - changes to LIB_LIST 27# - changes to SOURCES 28# - includes via include_directories 29# 30# and keep everything else private 31 32include_directories(.) 33 34execute_process( COMMAND grep -c illumos /lib/ld.so.1 35 OUTPUT_VARIABLE ILLUMOS ERROR_QUIET ) 36# Chomp the \n at end of output. 37string(REGEX REPLACE "[\n]+" "" ILLUMOS "${ILLUMOS}") 38 39if (NOT ${ILLUMOS} MATCHES "0") 40 set(ILLUMOS 1) 41endif() 42 43set(LWS_PLAT_UNIX 1) 44list(APPEND SOURCES 45 plat/unix/unix-caps.c 46 plat/unix/unix-misc.c 47 plat/unix/unix-init.c 48) 49if (LWS_WITH_FILE_OPS) 50 list(APPEND SOURCES plat/unix/unix-file.c) 51endif() 52if (LWS_WITH_NETWORK) 53 list(APPEND SOURCES 54 plat/unix/unix-pipe.c 55 plat/unix/unix-service.c 56 plat/unix/unix-sockets.c 57 plat/unix/unix-fds.c 58 ) 59 if (LWS_WITH_SYS_ASYNC_DNS) 60 if (LWS_PLAT_ANDROID) 61 list(APPEND SOURCES plat/unix/android/android-resolv.c) 62 else() 63 list(APPEND SOURCES plat/unix/unix-resolv.c) 64 endif() 65 endif() 66endif() 67 68if (LWS_WITH_PLUGINS_API) 69 list(APPEND SOURCES plat/unix/unix-plugins.c) 70endif() 71 72if (LWS_WITH_SPAWN) 73 list(APPEND SOURCES plat/unix/unix-spawn.c) 74endif() 75 76if (HAIKU) 77 set(CMAKE_REQUIRED_LIBRARIES network) 78 list(APPEND LIB_LIST_AT_END network) 79endif() 80 81IF (CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT LWS_WITHOUT_EVENTFD) 82 CHECK_FUNCTION_EXISTS(eventfd_read LWS_HAVE_EVENTFD) 83endif() 84 85list(APPEND LIB_LIST_AT_END m) 86 87if (ILLUMOS) 88 list(APPEND LIB_LIST_AT_END socket) 89endif() 90 91if (LWS_HAVE_LIBCAP) 92 list(APPEND LIB_LIST_AT_END cap) 93endif() 94 95if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") 96 list(APPEND LIB_LIST_AT_END socket) 97endif() 98 99list(APPEND LIB_LIST_AT_END ${CMAKE_DL_LIBS}) 100 101# 102# Keep explicit parent scope exports at end 103# 104 105exports_to_parent_scope() 106set(LWS_PLAT_UNIX ${LWS_PLAT_UNIX} PARENT_SCOPE) 107set(ILLUMOS ${ILLUMOS} PARENT_SCOPE) 108set(LIB_LIST_AT_END ${LIB_LIST_AT_END} PARENT_SCOPE) 109set(LWS_PLAT_UNIX ${LWS_PLAT_UNIX} PARENT_SCOPE) 110