1# 2# Copyright (C) 2015-2015 Oleg Alexeenkov 3# Copyright (C) 2015-2019 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 33################################################# 34# INCLUDE MODULES 35################################################# 36 37include(CheckIncludeFile) 38 39 40################################################# 41# CHECK INCLUDES 42################################################# 43 44include_directories(${CMAKE_SOURCE_DIR}/usrsctplib) 45 46 47################################################# 48# OS DEPENDENT 49################################################# 50 51if (CMAKE_SYSTEM_NAME MATCHES "Linux") 52 add_definitions(-D_GNU_SOURCE) 53endif () 54 55if (CMAKE_SYSTEM_NAME MATCHES "Darwin") 56 add_definitions(-D__APPLE_USE_RFC_2292) 57endif () 58 59if (MSYS OR MINGW) 60 message(STATUS "MSYS / MINGW") 61 add_definitions(-D__USE_MINGW_ANSI_STDIO) 62 # 0x0601 = Windows 7 API 63 add_definitions(-DWINVER=0x0601) 64 add_definitions(-D_WIN32_WINNT=0x0601) 65 66 if (CMAKE_C_COMPILER_ID MATCHES "GNU") 67 message(STATUS "MSYS / MINGW + GCC") 68 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format") 69 endif () 70endif () 71 72 73################################################# 74# MISC 75################################################# 76 77find_package(Threads) 78 79 80################################################# 81# PROGRAMS 82################################################# 83 84list(APPEND check_programs 85 chargen_server_upcall.c 86 client.c 87 client_upcall.c 88 daytime_server.c 89 daytime_server_upcall.c 90 discard_server.c 91 discard_server_upcall.c 92 echo_server.c 93 echo_server_upcall.c 94 ekr_client.c 95 ekr_loop.c 96 ekr_loop_offload.c 97 ekr_loop_upcall.c 98 ekr_peer.c 99 ekr_server.c 100 http_client.c 101 http_client_upcall.c 102 rtcweb.c 103 st_client.c 104 test_libmgmt.c 105 test_timer.c 106 tsctp.c 107 tsctp_upcall.c 108) 109 110foreach (source_file ${check_programs}) 111 get_filename_component(source_file_we ${source_file} NAME_WE) 112 add_executable( 113 ${source_file_we} 114 ${source_file} 115 programs_helper.c 116 ) 117 118 target_link_libraries( 119 ${source_file_we} 120 ${programs_link_library} 121 ${CMAKE_THREAD_LIBS_INIT} 122 ) 123endforeach () 124