-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakelists.txt
74 lines (53 loc) · 2.12 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
63
64
65
66
67
68
69
70
71
72
73
74
cmake_minimum_required(VERSION 3.10)
SET(CMAKE_C_COMPILER gcc)
SET(CMAKE_CXX_COMPILER g++)
# set the project name
project(demo VERSION 1.0)
set(CMAKE_PREFIX_PATH $ENV{QT_DIR})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(OPENSSL_ROOT_DIR ${CMAKE_SOURCE_DIR}/lib/openssl-0.9.8k_X64)
find_package(Qt6 COMPONENTS Widgets Core REQUIRED)
aux_source_directory(src/pcap PCAP_SRC_LIST)
aux_source_directory(src/gui GUI_SRC_LIST)
aux_source_directory(src/pcapDemo PCAP_DEMO_SRC_LIST)
#aux_source_directory(fake FAKE_SRC_LIST)
aux_source_directory(src/utils UTILS_SRC_LIST)
file(GLOB QT_HEADERS include/gui/*.h)
#set(QT_HEADERS "include/gui/*.h")
message("qtheaders ${QT_HEADERS}")
# add lib path
#file()
link_directories(${CMAKE_SOURCE_DIR}/lib/x64)
link_directories(${CMAKE_SOURCE_DIR}/lib/py)
file(GLOB QT_UIS ${CMAKE_SOURCE_DIR}/src/gui/*.ui)
qt6_wrap_ui(UI_HEADERS ${QT_UIS})
# set output path
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
add_executable(${CMAKE_PROJECT_NAME} WIN32 src/main.cpp ${PCAP_SRC_LIST} ${GUI_SRC_LIST} ${QT_HEADERS} ${UI_HEADERS} ${UTILS_SRC_LIST})
add_executable("pcap_demo" WIN32 ${PCAP_DEMO_SRC_LIST})
# target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
# link lib file
target_link_libraries(${CMAKE_PROJECT_NAME} Packet)
target_link_libraries(${CMAKE_PROJECT_NAME} wpcap)
target_link_libraries(${CMAKE_PROJECT_NAME} ws2_32)
target_link_libraries(${CMAKE_PROJECT_NAME} python3)
target_link_libraries(${CMAKE_PROJECT_NAME} python311)
target_link_libraries("pcap_demo" Packet)
target_link_libraries("pcap_demo" wpcap)
target_link_libraries("pcap_demo" ws2_32)
target_link_libraries(${CMAKE_PROJECT_NAME}
Qt6::Widgets
Qt6::Core)
target_include_directories(demo PUBLIC
"${PROJECT_BINARY_DIR}"
"include"
)
target_include_directories("pcap_demo" PUBLIC
"${PROJECT_BINARY_DIR}"
"include"
)