-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
executable file
·62 lines (46 loc) · 1.57 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
cmake_minimum_required(VERSION 3.1)
project(cap-json LANGUAGES CXX)
set (CMAKE_CXX_STANDARD 14)
set (CMAKE_CXX_STANDARD_REQUIRED True)
set (CMAKE_BUILD_TYPE Debug)
add_executable(${PROJECT_NAME}
src/capture.h
src/capture.cpp
src/main.cpp
src/network_packet.h
src/network_packet.cpp
src/json.h
src/json.cpp
src/utility.h
src/utility.cpp
)
set(RAPIDJSON_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/external/rapidjson/include)
if(WIN32)
#find libtins library on windows
#requires that both the libtins library and the WinPCAP developer pack are stored in the external directory
set (LIBTINS_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/external/libtins/include)
set (WINPCAP_DEV_PACK ${CMAKE_SOURCE_DIR}/external/WpdPack/Include)
find_library(LIBTINS tins
${CMAKE_SOURCE_DIR}/external/libtins/build/lib/Release
)
find_library(WPCAP wpcap
${CMAKE_SOURCE_DIR}/external/WpdPack/Lib/x64
)
find_library(PACKET Packet
${CMAKE_SOURCE_DIR}/external/WpdPack/Lib/x64
)
include_directories(
${LIBTINS_INCLUDE_DIR}
${WINPCAP_DEV_PACK}
${RAPIDJSON_INCLUDE_DIR}
)
target_link_libraries(${PROJECT_NAME}
${LIBTINS} ${WPCAP} ${PACKET} ws2_32 Iphlpapi
)
add_compile_definitions(TINS_STATIC)
else()
#find the libtins library on Linux and other UNIX like operating systems
find_package(libtins REQUIRED)
include_directories(${RAPIDJSON_INCLUDE_DIR})
target_link_libraries(${CMAKE_PROJECT_NAME} tins -pthread)
endif()