-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathCMakeLists.txt
62 lines (50 loc) · 1.69 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright (C) 2016-2022 Davidson Francis <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
cmake_minimum_required(VERSION 3.5.2)
project(ws C)
set(CMAKE_C_STANDARD 99)
include_directories(include)
add_library(ws
src/ws.c
src/base64.c
src/sha1.c
src/handshake.c
src/utf8.c
)
target_include_directories(ws INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
if(WIN32)
target_link_libraries(ws pthread ws2_32 -static)
else()
target_link_libraries(ws pthread)
endif(WIN32)
add_executable(toyws_test
extra/toyws/tws_test.c
extra/toyws/toyws.c)
if(WIN32)
target_link_libraries(toyws_test ws2_32 -static)
endif(WIN32)
# Examples files
add_subdirectory(examples)
option(ENABLE_WSSERVER_TEST "Enable wsServer testing (requires Autobahn)" OFF)
if(ENABLE_WSSERVER_TEST)
enable_testing()
# Disable verbose output of echo
target_compile_definitions(echo PRIVATE DISABLE_VERBOSE)
add_subdirectory(tests)
endif(ENABLE_WSSERVER_TEST)
option(VALIDATE_UTF8 "Enable UTF-8 validation (default ON)" ON)
if(VALIDATE_UTF8)
target_compile_definitions(ws PRIVATE VALIDATE_UTF8)
endif(VALIDATE_UTF8)