CMakeLists.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. list(APPEND SOURCES
  33. plat/windows/windows-fds.c
  34. plat/windows/windows-file.c
  35. plat/windows/windows-init.c
  36. plat/windows/windows-misc.c
  37. plat/windows/windows-pipe.c
  38. plat/windows/windows-plugins.c
  39. plat/windows/windows-service.c
  40. plat/windows/windows-sockets.c
  41. )
  42. if (LWS_WITH_SYS_ASYNC_DNS)
  43. list(APPEND SOURCES plat/windows/windows-resolv.c)
  44. endif()
  45. if (LWS_WITH_SPAWN)
  46. list(APPEND SOURCES plat/windows/windows-spawn.c)
  47. endif()
  48. if (LWS_WITH_ZLIB AND LWS_WITH_BUNDLED_ZLIB)
  49. set(WIN32_ZLIB_PATH "win32port/zlib")
  50. set(ZLIB_SRCS
  51. ${WIN32_ZLIB_PATH}/adler32.c
  52. ${WIN32_ZLIB_PATH}/compress.c
  53. ${WIN32_ZLIB_PATH}/crc32.c
  54. ${WIN32_ZLIB_PATH}/deflate.c
  55. ${WIN32_ZLIB_PATH}/gzlib.c
  56. ${WIN32_ZLIB_PATH}/gzread.c
  57. ${WIN32_ZLIB_PATH}/gzwrite.c
  58. ${WIN32_ZLIB_PATH}/infback.c
  59. ${WIN32_ZLIB_PATH}/inffast.c
  60. ${WIN32_ZLIB_PATH}/inflate.c
  61. ${WIN32_ZLIB_PATH}/inftrees.c
  62. ${WIN32_ZLIB_PATH}/trees.c
  63. ${WIN32_ZLIB_PATH}/uncompr.c
  64. ${WIN32_ZLIB_PATH}/zutil.c)
  65. add_library(zlib_internal STATIC ${ZLIB_SRCS})
  66. set(ZLIB_INCLUDE_DIRS ${WIN32_ZLIB_PATH})
  67. get_property(ZLIB_LIBRARIES TARGET zlib_internal PROPERTY LOCATION)
  68. set(ZLIB_FOUND 1)
  69. # Make sure zlib_internal is compiled before the libs.
  70. foreach (lib ${LWS_LIBRARIES})
  71. add_dependencies(${lib} zlib_internal)
  72. endforeach()
  73. endif()
  74. # Add helper files for Windows
  75. # (from ./lib perspective)
  76. set(WIN32_HELPERS_PATH ../win32port/win32helpers)
  77. # from our perspective in ./lib/plat/windows
  78. include_directories(../../${WIN32_HELPERS_PATH})
  79. list(APPEND SOURCES
  80. ${WIN32_HELPERS_PATH}/gettimeofday.c
  81. )
  82. list(APPEND HDR_PRIVATE
  83. ${WIN32_HELPERS_PATH}/gettimeofday.h
  84. )
  85. #
  86. # Keep explicit parent scope exports at end
  87. #
  88. exports_to_parent_scope()
  89. set(WIN32_HELPERS_PATH ${WIN32_HELPERS_PATH} PARENT_SCOPE)
  90. set(HDR_PRIVATE ${HDR_PRIVATE} PARENT_SCOPE)
  91. set(ZLIB_FOUND ${ZLIB_FOUND} PARENT_SCOPE)
  92. set(LIB_LIST_AT_END ${LIB_LIST_AT_END} PARENT_SCOPE)