-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
CMakeLists.txt
54 lines (39 loc) · 1.1 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
cmake_minimum_required(VERSION 3.0)
project(Multicast-Client-Server-Example)
if(UNIX)
add_definitions(-DUNIX)
endif(UNIX)
if(WIN32)
add_definitions(-DWIN32)
if(WINCE)
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ws2)
else()
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ws2_32)
endif()
# MSVC older than VS 14.0 does not support the C99-style variable declarations in the middle of a block like we have them.
# A workaround is to tell the compiler to treat C sources as C++ ones.
if(MSVC AND MSVC_VERSION LESS 1900)
file(GLOB_RECURSE c_sources "*.c")
set_source_files_properties(${c_sources} PROPERTIES LANGUAGE CXX)
endif()
endif(WIN32)
# the server
SET(server_SRCS
src/server.c
src/msock.c
)
add_executable(server ${server_SRCS})
target_link_libraries(server
${ADDITIONAL_LIBS}
)
install(TARGETS server DESTINATION bin)
# the client
SET(client_SRCS
src/client.c
src/msock.c
)
add_executable(client ${client_SRCS})
target_link_libraries(client
${ADDITIONAL_LIBS}
)
install(TARGETS client DESTINATION bin)