CMakeLists.txt 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #
  2. # Copyright (C) 2015-2015 Oleg Alexeenkov
  3. # Copyright (C) 2015-2020 Felix Weinrank
  4. #
  5. # All rights reserved.
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions
  9. # are met:
  10. # 1. Redistributions of source code must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. # 2. Redistributions in binary form must reproduce the above copyright
  13. # notice, this list of conditions and the following disclaimer in the
  14. # documentation and/or other materials provided with the distribution.
  15. # 3. Neither the name of the project nor the names of its contributors
  16. # may be used to endorse or promote products derived from this software
  17. # without specific prior written permission.
  18. #
  19. # THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  20. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. # ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
  23. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25. # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29. # SUCH DAMAGE.
  30. #
  31. #################################################
  32. # INCLUDE MODULES
  33. #################################################
  34. include(CheckIncludeFile)
  35. #################################################
  36. # CHECK INCLUDES
  37. #################################################
  38. include_directories(${CMAKE_SOURCE_DIR}/usrsctplib)
  39. #################################################
  40. # OS DEPENDENT
  41. #################################################
  42. if (CMAKE_SYSTEM_NAME MATCHES "Linux")
  43. add_definitions(-D_GNU_SOURCE)
  44. endif ()
  45. if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "iOS")
  46. add_definitions(-D__APPLE_USE_RFC_2292)
  47. endif ()
  48. if (MSYS OR MINGW)
  49. message(STATUS "MSYS / MINGW")
  50. add_definitions(-D__USE_MINGW_ANSI_STDIO)
  51. # 0x0601 = Windows 7 API
  52. add_definitions(-DWINVER=0x0601)
  53. add_definitions(-D_WIN32_WINNT=0x0601)
  54. if (CMAKE_C_COMPILER_ID MATCHES "GNU")
  55. message(STATUS "MSYS / MINGW + GCC")
  56. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format")
  57. endif ()
  58. endif ()
  59. #################################################
  60. # MISC
  61. #################################################
  62. find_package(Threads)
  63. #################################################
  64. # PROGRAMS
  65. #################################################
  66. list(APPEND check_programs
  67. chargen_server_upcall.c
  68. client.c
  69. client_upcall.c
  70. daytime_server.c
  71. daytime_server_upcall.c
  72. discard_server.c
  73. discard_server_upcall.c
  74. echo_server.c
  75. echo_server_upcall.c
  76. ekr_client.c
  77. ekr_loop.c
  78. ekr_loop_upcall.c
  79. ekr_peer.c
  80. ekr_server.c
  81. http_client.c
  82. http_client_upcall.c
  83. rtcweb.c
  84. st_client.c
  85. test_libmgmt.c
  86. test_timer.c
  87. tsctp.c
  88. tsctp_upcall.c
  89. )
  90. foreach (source_file ${check_programs})
  91. get_filename_component(source_file_we ${source_file} NAME_WE)
  92. add_executable(
  93. ${source_file_we}
  94. ${source_file}
  95. programs_helper.c
  96. )
  97. target_link_libraries(
  98. ${source_file_we}
  99. "usrsctp"
  100. ${CMAKE_THREAD_LIBS_INIT}
  101. )
  102. if (APPLE)
  103. set_target_properties(
  104. ${source_file_we}
  105. PROPERTIES
  106. XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER
  107. com.github.sctplab.usrsctp.${source_file_we}
  108. )
  109. endif()
  110. endforeach ()