-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
72 lines (58 loc) · 1.79 KB
/
CMakeLists.txt
File metadata and controls
72 lines (58 loc) · 1.79 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
cmake_minimum_required(VERSION 4.0.0)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(cs2guiserver VERSION 3.0.0 LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
# A way to provide a path to statically built Qt installation without changing
# presets or passing additional variables, mostly intended for development.
if (NOT Qt6_ROOT)
set(ENV_FILE "${CMAKE_SOURCE_DIR}/.env")
if (EXISTS ${ENV_FILE})
file(STRINGS ${ENV_FILE} ENV_VARS)
foreach(VAR ${ENV_VARS})
# Split the line into KEY and VALUE.
if (VAR MATCHES "([^=]+)=(.*)")
set(ENV{${CMAKE_MATCH_1}} ${CMAKE_MATCH_2})
endif ()
endforeach()
message(STATUS ".env file loaded.")
else ()
message(STATUS ".env file not found at ${ENV_FILE}.")
endif ()
endif ()
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick BYPASS_PROVIDER)
find_package(cpr REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(SQLiteCpp REQUIRED)
qt_policy(SET QTP0001 NEW)
qt_standard_project_setup()
# This policy allows overriding options defined in the libraries without modifying its code.
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(BUILD_SHARED_LIBS FALSE)
set(NFD_PORTAL ON)
add_subdirectory(third_party/nfd EXCLUDE_FROM_ALL)
if (LINUX)
set(BUILD_SHARED_LIBS FALSE)
elseif (WIN32)
set(BUILD_SHARED_LIBS TRUE)
endif ()
add_subdirectory(third_party/rconpp EXCLUDE_FROM_ALL)
add_subdirectory(src)
# Tests
if (BUILD_TESTS)
include(CTest)
add_subdirectory(tests)
endif ()
#
# Installation steps.
#
install(TARGETS ${PROJECT_NAME}
DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
#
# Packaging for the distribution.
#
include(CPack)
set(CPACK_PACKAGE_VENDOR "Monkeber")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A simple manager for CS2 server that you can use to send rcon commands or create 'actions' with some predefined commands")