forked from truvorskameikin/udp-discovery-cpp
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
46 lines (37 loc) · 996 Bytes
/
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
cmake_minimum_required(VERSION 3.4)
set(LIB_SOURCES
endpoint.cpp
ip_port.cpp
protocol.cpp)
set(LIB_HEADERS
endpoint.hpp
ip_port.hpp
protocol.hpp)
add_library(udp-discovery STATIC ${LIB_SOURCES} ${LIB_HEADERS})
set(DISCOVERY_EXAMPLE_SOURCES
discovery_example.cpp)
set(DISCOVERY_EXAMPLE_LIBS
udp-discovery)
set(DISCOVERY_TOOL_SOURCES
discovery_tool.cpp)
set(DISCOVERY_TOOL_LIBS
udp-discovery)
if(WIN32)
set(DISCOVERY_EXAMPLE_LIBS ${DISCOVERY_EXAMPLE_LIBS}
Ws2_32)
endif(WIN32)
if(APPLE)
elseif(UNIX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
endif()
if(APPLE)
elseif(UNIX)
set(DISCOVERY_EXAMPLE_LIBS ${DISCOVERY_EXAMPLE_LIBS}
rt)
set(DISCOVERY_TOOL_LIBS ${DISCOVERY_TOOL_LIBS}
rt)
endif()
add_executable(udp-discovery-example ${DISCOVERY_EXAMPLE_SOURCES})
target_link_libraries(udp-discovery-example ${DISCOVERY_EXAMPLE_LIBS})
add_executable(udp-discovery-tool ${DISCOVERY_TOOL_SOURCES})
target_link_libraries(udp-discovery-tool ${DISCOVERY_TOOL_LIBS})