This repository was archived by the owner on Oct 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
101 lines (81 loc) · 2.03 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(ClientServerMessages VERSION 0.1.2 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY lib)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
find_package(Qt5 COMPONENTS REQUIRED
Core
Gui
Widgets
network
)
set(SERVER_SRC
src/server.cpp
src/Connections.cpp
)
qt5_wrap_cpp(SERVER_SRC
include/server.h
)
qt5_wrap_ui(server_ui
${CMAKE_CURRENT_SOURCE_DIR}/ui/serverdialog.ui
)
add_executable(Server
include/server.h
${SERVER_SRC}
${server_ui}
src/ServerMain.cpp
)
target_link_libraries(Server
PRIVATE
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Network
)
target_include_directories(Server
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}
)
set(CLIENT_SRC
src/client.cpp
src/ClientConnection.cpp
)
qt5_wrap_cpp(CLIENT_SRC
include/client.h
)
qt5_wrap_ui(client_ui
${CMAKE_CURRENT_SOURCE_DIR}/ui/clientdialog.ui
)
add_executable(Client
include/client.h
${CLIENT_SRC}
${client_ui}
src/ClientMain.cpp
)
target_link_libraries(Client
PRIVATE
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Network
)
target_include_directories(Client
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}
)
# TODO: add copying qwindows.dll
if(WIN32)
add_custom_target(COPY_QT_DLLS ALL
COMMENT "Deploying Qt Dlls..."
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Core> $<TARGET_FILE_DIR:Server>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Gui> $<TARGET_FILE_DIR:Server>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Widgets> $<TARGET_FILE_DIR:Server>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Network> $<TARGET_FILE_DIR:Server>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::QWindowsIntegrationPlugin> $<TARGET_FILE_DIR:Server>
)
endif()