Felix Weinrank | 71be071 | 2015-08-26 13:52:37 +0200 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2015-2015 Oleg Alexeenkov |
Felix Weinrank | 2e5216b | 2018-08-06 14:03:13 +0200 | [diff] [blame] | 3 | # Copyright (C) 2015-2018 Felix Weinrank |
Felix Weinrank | 71be071 | 2015-08-26 13:52:37 +0200 | [diff] [blame] | 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 | |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 32 | project(usrsctplib) |
Felix Weinrank | a0ccbee | 2017-11-16 15:06:23 +0100 | [diff] [blame] | 33 | cmake_minimum_required(VERSION 3.0) |
Felix Weinrank | 69bbc20 | 2016-03-16 11:29:09 +0100 | [diff] [blame] | 34 | |
| 35 | # Debug build type as default |
| 36 | if (NOT CMAKE_BUILD_TYPE) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 37 | message(STATUS "No build type selected, using DEBUG") |
| 38 | set(CMAKE_BUILD_TYPE "DEBUG") |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 39 | endif () |
| 40 | |
| 41 | include(CheckStructHasMember) |
Felix Weinrank | 5b9ee52 | 2017-07-14 15:45:16 +0200 | [diff] [blame] | 42 | include(CheckIncludeFile) |
| 43 | include(CheckIncludeFiles) |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 44 | include(CheckCCompilerFlag) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 45 | |
| 46 | ################################################# |
| 47 | # CHECK OPTIONS |
| 48 | ################################################# |
| 49 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 50 | option(sctp_invariants "Add runtime checks" 0) |
| 51 | if (sctp_invariants) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 52 | add_definitions(-DINVARIANTS) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 53 | endif () |
| 54 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 55 | option(sctp_debug "Provide debug information" 1) |
| 56 | if (sctp_debug) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 57 | add_definitions(-DSCTP_DEBUG) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 58 | endif () |
| 59 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 60 | option(sctp_inet "Support IPv4" 1) |
| 61 | if (sctp_inet) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 62 | add_definitions(-DINET) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 63 | endif () |
| 64 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 65 | option(sctp_inet6 "Support IPv6" 1) |
Felix Weinrank | 2230605 | 2017-11-15 14:33:14 +0100 | [diff] [blame] | 66 | if (sctp_inet6) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 67 | add_definitions(-DINET6) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 68 | endif () |
| 69 | |
Michael Tuexen | daaaf94 | 2018-05-21 18:19:52 +0200 | [diff] [blame] | 70 | option(sctp_werror "Treat warning as error" 1) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 71 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 72 | option(sctp_link_programs_static "Link example programs static" 0) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 73 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 74 | option(sctp_build_programs "Build example programs" 1) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 75 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 76 | option(sctp_sanitizer_address "Compile with address sanitizer" 0) |
Felix Weinrank | 3f31a25 | 2017-07-18 09:47:59 +0200 | [diff] [blame] | 77 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 78 | option(sctp_sanitizer_memory "Compile with memory sanitizer" 0) |
Felix Weinrank | 3f31a25 | 2017-07-18 09:47:59 +0200 | [diff] [blame] | 79 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 80 | if (sctp_sanitizer_address AND sctp_sanitizer_memory) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 81 | message(FATAL_ERROR "Can not compile with both sanitizer options") |
Felix Weinrank | 3f31a25 | 2017-07-18 09:47:59 +0200 | [diff] [blame] | 82 | endif () |
| 83 | |
Felix Weinrank | cbe162f | 2018-07-26 18:22:13 +0200 | [diff] [blame] | 84 | if (sctp_link_programs_static OR WIN32) |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 85 | set(programs_link_library "usrsctp-static") |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 86 | else () |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 87 | set(programs_link_library "usrsctp") |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 88 | endif () |
| 89 | |
| 90 | |
| 91 | ################################################# |
Felix Weinrank | 5b9ee52 | 2017-07-14 15:45:16 +0200 | [diff] [blame] | 92 | # CHECK FOR TYPES AND FUNCTIONS |
| 93 | ################################################# |
| 94 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 95 | check_include_files("sys/queue.h" have_sys_queue_h) |
| 96 | if (have_sys_queue_h) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 97 | add_definitions(-DHAVE_SYS_QUEUE_H) |
Felix Weinrank | 5b9ee52 | 2017-07-14 15:45:16 +0200 | [diff] [blame] | 98 | endif () |
| 99 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 100 | check_include_files("sys/socket.h;linux/if_addr.h" have_linux_if_addr_h) |
| 101 | if (have_linux_if_addr_h) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 102 | add_definitions(-DHAVE_LINUX_IF_ADDR_H) |
Felix Weinrank | 5b9ee52 | 2017-07-14 15:45:16 +0200 | [diff] [blame] | 103 | endif () |
| 104 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 105 | check_include_files("sys/socket.h;linux/rtnetlink.h" have_linux_rtnetlink_h) |
| 106 | if (have_linux_rtnetlink_h) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 107 | add_definitions(-DHAVE_LINUX_RTNETLINK_H) |
Felix Weinrank | 5b9ee52 | 2017-07-14 15:45:16 +0200 | [diff] [blame] | 108 | endif () |
| 109 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 110 | check_include_files("sys/types.h;netinet/in.h;netinet/ip.h;netinet/ip_icmp.h" have_netinet_ip_icmp_h) |
| 111 | if (have_netinet_ip_icmp_h) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 112 | add_definitions(-DHAVE_NETINET_IP_ICMP_H) |
Felix Weinrank | 5b9ee52 | 2017-07-14 15:45:16 +0200 | [diff] [blame] | 113 | endif () |
| 114 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 115 | check_include_files("stdatomic.h" have_stdatomic_h) |
| 116 | if (have_stdatomic_h) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 117 | add_definitions(-DHAVE_STDATOMIC_H) |
Felix Weinrank | 5b9ee52 | 2017-07-14 15:45:16 +0200 | [diff] [blame] | 118 | endif () |
| 119 | |
| 120 | |
| 121 | ################################################# |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 122 | # CHECK STRUCT MEMBERS |
| 123 | ################################################# |
| 124 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 125 | set(CMAKE_REQUIRED_INCLUDES "${CMAKE_SOURCE_DIR}/usrsctplib") |
| 126 | |
| 127 | check_include_file(usrsctp.h have_usrsctp_h) |
| 128 | if (NOT have_usrsctp_h) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 129 | message(FATAL_ERROR "usrsctp.h not found") |
Felix Weinrank | 5b9ee52 | 2017-07-14 15:45:16 +0200 | [diff] [blame] | 130 | endif () |
Felix Weinrank | f9f5222 | 2017-07-13 01:09:34 +0200 | [diff] [blame] | 131 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 132 | check_struct_has_member("struct sockaddr" "sa_len" "sys/types.h;sys/socket.h" have_sa_len) |
| 133 | if (have_sa_len) |
| 134 | message(STATUS "have_sa_len") |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 135 | add_definitions(-DHAVE_SA_LEN) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 136 | endif () |
| 137 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 138 | check_struct_has_member("struct sockaddr_in" "sin_len" "sys/types.h;netinet/in.h" have_sin_len) |
| 139 | if (have_sin_len) |
| 140 | message(STATUS "have_sin_len") |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 141 | add_definitions(-DHAVE_SIN_LEN) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 142 | endif () |
| 143 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 144 | check_struct_has_member("struct sockaddr_in6" "sin6_len" "sys/types.h;netinet/in.h" have_sin6_len) |
| 145 | if (have_sin6_len) |
| 146 | message(STATUS "have_sin6_len") |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 147 | add_definitions(-DHAVE_SIN6_LEN) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 148 | endif () |
| 149 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 150 | check_struct_has_member("struct sockaddr_conn" "sconn_len" "usrsctp.h" have_sconn_len) |
| 151 | if (have_sconn_len) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 152 | message(STATUS "HAVE_SCONN_LEN") |
| 153 | add_definitions(-DHAVE_SCONN_LEN) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 154 | endif () |
| 155 | |
| 156 | |
| 157 | ################################################# |
| 158 | # COMPILER SETTINGS |
| 159 | ################################################# |
| 160 | |
| 161 | # SETTINGS FOR UNIX COMPILER |
Felix Weinrank | 3c3962c | 2018-08-02 14:00:47 +0200 | [diff] [blame] | 162 | if (CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "AppleClang" OR CMAKE_C_COMPILER_ID MATCHES "GNU") |
Felix Weinrank | a0ccbee | 2017-11-16 15:06:23 +0100 | [diff] [blame] | 163 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -pedantic -Wall -Wextra") |
Felix Weinrank | cbe162f | 2018-07-26 18:22:13 +0200 | [diff] [blame] | 164 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c99 -pedantic -Wall -Wextra") |
Felix Weinrank | 3f31a25 | 2017-07-18 09:47:59 +0200 | [diff] [blame] | 165 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 166 | check_c_compiler_flag(-Wfloat-equal has_wfloat_equal) |
| 167 | if (has_wfloat_equal) |
| 168 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-equal") |
| 169 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfloat-equal") |
| 170 | endif () |
| 171 | |
| 172 | check_c_compiler_flag(-Wshadow has_wshadow) |
| 173 | if (has_wshadow) |
| 174 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow") |
| 175 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") |
| 176 | endif () |
| 177 | |
| 178 | check_c_compiler_flag(-Wpointer-arith has_wpointer_aritih) |
| 179 | if (has_wpointer_aritih) |
| 180 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith") |
| 181 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith") |
| 182 | endif () |
| 183 | |
| 184 | check_c_compiler_flag(-Wunreachable-code has_wunreachable_code) |
| 185 | if (has_wunreachable_code) |
| 186 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunreachable-code") |
| 187 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunreachable-code") |
| 188 | endif () |
| 189 | |
| 190 | check_c_compiler_flag(-Winit-self has_winit_self) |
| 191 | if (has_winit_self) |
| 192 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Winit-self") |
| 193 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Winit-self") |
| 194 | endif () |
| 195 | |
Felix Weinrank | 41fbcc1 | 2017-11-15 14:48:32 +0100 | [diff] [blame] | 196 | check_c_compiler_flag(-Wno-unused-function has_wno_unused_function) |
| 197 | if (has_wno_unused_function) |
| 198 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function") |
| 199 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function") |
| 200 | endif () |
| 201 | |
| 202 | check_c_compiler_flag(-Wno-unused-parameter has_wno_unused_parameter) |
| 203 | if (has_wno_unused_parameter) |
| 204 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter") |
| 205 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") |
| 206 | endif () |
| 207 | |
Felix Weinrank | 9755866 | 2017-11-15 14:52:15 +0100 | [diff] [blame] | 208 | check_c_compiler_flag(-Wno-unreachable-code has_wno_unreachable_code) |
| 209 | if (has_wno_unreachable_code) |
| 210 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unreachable-code") |
| 211 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unreachable-code") |
| 212 | endif () |
| 213 | |
Felix Weinrank | a0a5a65 | 2018-03-23 20:09:51 +0100 | [diff] [blame] | 214 | check_c_compiler_flag(-Wstrict-prototypes has_wstrict_prototypes) |
| 215 | if (has_wstrict_prototypes) |
| 216 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes") |
| 217 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-prototypes") |
| 218 | endif () |
| 219 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 220 | if (sctp_werror) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 221 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") |
| 222 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") |
| 223 | endif () |
Felix Weinrank | 3f31a25 | 2017-07-18 09:47:59 +0200 | [diff] [blame] | 224 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 225 | if (sctp_sanitizer_address) |
| 226 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -g") |
| 227 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -g") |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 228 | endif () |
Felix Weinrank | 3f31a25 | 2017-07-18 09:47:59 +0200 | [diff] [blame] | 229 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 230 | if (sctp_sanitizer_memory) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 231 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory -fno-omit-frame-pointer -g -fsanitize-memory-track-origins") |
| 232 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory -fno-omit-frame-pointer -g -fsanitize-memory-track-origins") |
| 233 | endif () |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 234 | endif () |
| 235 | |
| 236 | # SETTINGS FOR VISUAL STUDIO COMPILER |
Felix Weinrank | 3c3962c | 2018-08-02 14:00:47 +0200 | [diff] [blame] | 237 | if (CMAKE_C_COMPILER_ID MATCHES "MSVC") |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 238 | if (CMAKE_C_FLAGS MATCHES "/W[0-4]") |
Felix Weinrank | 2e5216b | 2018-08-06 14:03:13 +0200 | [diff] [blame] | 239 | string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 240 | else () |
Felix Weinrank | 2e5216b | 2018-08-06 14:03:13 +0200 | [diff] [blame] | 241 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 242 | endif () |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 243 | |
Felix Weinrank | 2e5216b | 2018-08-06 14:03:13 +0200 | [diff] [blame] | 244 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4100") # 'identifier' : unreferenced formal parameter |
| 245 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127") # conditional expression is constant |
| 246 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4200") # nonstandard extension used : zero-sized array in struct/union |
| 247 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4214") # bit field types other than int |
| 248 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4706") # assignment within conditional expression |
| 249 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4245") # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch |
| 250 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4389") # 'operator' : signed/unsigned mismatch |
| 251 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4702") # unreachable code |
| 252 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4701") # Potentially uninitialized local variable 'name' used |
| 253 | |
| 254 | # ToDo |
| 255 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244") # 'conversion' conversion from 'type1' to 'type2', possible loss of data |
| 256 | |
| 257 | if (sctp_werror) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 258 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") |
| 259 | endif () |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 260 | endif () |
| 261 | |
Felix Weinrank | 3c3962c | 2018-08-02 14:00:47 +0200 | [diff] [blame] | 262 | message(STATUS "Compiler flags (CMAKE_C_FLAGS): ${CMAKE_C_FLAGS}") |
| 263 | |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 264 | |
| 265 | ################################################# |
| 266 | # INCLUDE SUBDIRS |
| 267 | ################################################# |
Felix Weinrank | 69bbc20 | 2016-03-16 11:29:09 +0100 | [diff] [blame] | 268 | |
Felix Weinrank | 9acfd0f | 2015-08-26 13:01:12 +0200 | [diff] [blame] | 269 | add_subdirectory(usrsctplib) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 270 | |
Felix Weinrank | 396ed2a | 2017-11-15 14:17:00 +0100 | [diff] [blame] | 271 | if (sctp_build_programs) |
Felix Weinrank | 9d18096 | 2017-11-07 15:46:54 +0100 | [diff] [blame] | 272 | add_subdirectory(programs) |
Felix Weinrank | 6c32195 | 2017-07-12 01:06:33 +0200 | [diff] [blame] | 273 | endif () |