CMakeLists.txt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #
  2. # libwebsockets - small server side websockets and web server implementation
  3. #
  4. # Copyright (C) 2010 - 2020 Andy Green <[email protected]>
  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. include_directories(.)
  32. execute_process( COMMAND grep -c illumos /lib/ld.so.1
  33. OUTPUT_VARIABLE ILLUMOS ERROR_QUIET )
  34. # Chomp the \n at end of output.
  35. string(REGEX REPLACE "[\n]+" "" ILLUMOS "${ILLUMOS}")
  36. if (NOT ${ILLUMOS} MATCHES "0")
  37. set(ILLUMOS 1)
  38. endif()
  39. set(LWS_PLAT_UNIX 1)
  40. list(APPEND SOURCES
  41. plat/unix/unix-caps.c
  42. plat/unix/unix-misc.c
  43. plat/unix/unix-init.c
  44. )
  45. if (LWS_WITH_FILE_OPS)
  46. list(APPEND SOURCES plat/unix/unix-file.c)
  47. endif()
  48. if (LWS_WITH_NETWORK)
  49. list(APPEND SOURCES
  50. plat/unix/unix-pipe.c
  51. plat/unix/unix-service.c
  52. plat/unix/unix-sockets.c
  53. plat/unix/unix-fds.c
  54. )
  55. if (LWS_WITH_SYS_ASYNC_DNS)
  56. if (LWS_PLAT_ANDROID)
  57. list(APPEND SOURCES plat/unix/android/android-resolv.c)
  58. else()
  59. list(APPEND SOURCES plat/unix/unix-resolv.c)
  60. endif()
  61. endif()
  62. endif()
  63. if (LWS_WITH_PLUGINS_API)
  64. list(APPEND SOURCES plat/unix/unix-plugins.c)
  65. endif()
  66. if (LWS_WITH_SPAWN)
  67. list(APPEND SOURCES plat/unix/unix-spawn.c)
  68. endif()
  69. if (HAIKU)
  70. set(CMAKE_REQUIRED_LIBRARIES network)
  71. list(APPEND LIB_LIST_AT_END network)
  72. endif()
  73. IF (CMAKE_SYSTEM_NAME STREQUAL Linux)
  74. CHECK_FUNCTION_EXISTS(eventfd_read LWS_HAVE_EVENTFD)
  75. endif()
  76. list(APPEND LIB_LIST_AT_END m)
  77. if (ILLUMOS)
  78. list(APPEND LIB_LIST_AT_END socket)
  79. endif()
  80. if (LWS_HAVE_LIBCAP)
  81. list(APPEND LIB_LIST_AT_END cap)
  82. endif()
  83. if (${CMAKE_SYSTEM_NAME} MATCHES "QNX")
  84. list(APPEND LIB_LIST_AT_END socket)
  85. endif()
  86. list(APPEND LIB_LIST_AT_END dl)
  87. #
  88. # Keep explicit parent scope exports at end
  89. #
  90. exports_to_parent_scope()
  91. set(LWS_PLAT_UNIX ${LWS_PLAT_UNIX} PARENT_SCOPE)
  92. set(ILLUMOS ${ILLUMOS} PARENT_SCOPE)
  93. set(LIB_LIST_AT_END ${LIB_LIST_AT_END} PARENT_SCOPE)
  94. set(LWS_PLAT_UNIX ${LWS_PLAT_UNIX} PARENT_SCOPE)