-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
76 lines (63 loc) · 1.89 KB
/
Copy pathCMakeLists.txt
File metadata and controls
76 lines (63 loc) · 1.89 KB
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
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
set(PROJECT_NAME DirectPlayHelper)
include(ExternalProject)
project("${PROJECT_NAME}" VERSION 0.2 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
#####################################################################
# #
# DEPENDENCIES #
# #
#####################################################################
ExternalProject_Add(g3log_project
GIT_REPOSITORY https://github.com/KjellKod/g3log
GIT_TAG master
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/g3log"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/g3log -DG3_SHARED_LIB=OFF -DUSE_DYNAMIC_LOGGING_LEVELS=ON
)
ExternalProject_Get_Property(g3log_project install_dir)
message(STATUS "g3log installation directory: ${install_dir}")
set(g3log_LOC "${install_dir}/lib/libg3logger.a")
if(MSVC)
set(g3log_LOC "${install_dir}/lib/g3logger.lib")
endif()
add_library(g3log STATIC IMPORTED)
set_property(TARGET g3log PROPERTY IMPORTED_LOCATION
"${g3log_LOC}")
add_dependencies(g3log g3log_project)
#####################################################################
# #
# PROGRAM #
# #
#####################################################################
# build the app
add_executable("${PROJECT_NAME}"
src/main.cpp
src/DPServer.cpp
src/ArgParser.cpp
)
# Includes
target_include_directories("${PROJECT_NAME}" BEFORE
PUBLIC
include
"${install_dir}/include"
)
# build the inet library
add_subdirectory(src/inet)
# Link dependencies
if(WIN32)
set(ws2_32 ws2_32.lib)
endif()
target_link_libraries("${PROJECT_NAME}"
PUBLIC
g3log
"${ws2_32}"
inet
)
# Oh yeah, and add the tests
add_subdirectory(tests)
#############################
# INSTALL #
#############################
#install(TARGETS "${PROJECT_NAME}" DESTINATION bin)