-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
107 lines (82 loc) · 3.83 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
102
103
104
105
106
107
#-------------------------------------------------------------------------------------------
# Compile with GCC:
# rm -rf build && CC=gcc CXX=g++ cmake -B build && cmake --build build --parallel
#
# Compile with Intel C++ Compiler:
# rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build --parallel
#-------------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------------
# Project configuration.
#-------------------------------------------------------------------------------------------
# Require a minimum version of cmake.
cmake_minimum_required(VERSION 3.18)
# Set the name of the project.
project("addtofullpack_manager")
# Add a library target to be built from the source files.
add_library(${CMAKE_PROJECT_NAME} SHARED)
# Options
option(OPT_DEBUG "Build with debugging information and runtime checks." OFF)
option(OPT_NO_RTTI "Disable RTTI support." OFF)
option(OPT_NO_EXCEPTIONS "Disable exception handling table generation." OFF)
# Linking options
option(OPT_LINK_C "Linking with libc library." ON)
option(OPT_LINK_M "Linking with libm library." ON)
option(OPT_LINK_DL "Linking with libdl library." ON)
option(OPT_LINK_LIBGCC "Static linking with libgcc library." ON)
option(OPT_LINK_LIBSTDC "Static linking with libstdc++ library." ON)
# Set policies
cmake_policy(SET CMP0018 NEW)
cmake_policy(SET CMP0063 NEW)
cmake_policy(SET CMP0065 NEW)
cmake_policy(SET CMP0069 NEW)
cmake_policy(SET CMP0077 NEW)
cmake_policy(SET CMP0092 NEW)
# Settings
set(CMAKE_RULE_MESSAGES ON)
set(CMAKE_VERBOSE_MAKEFILE OFF)
include(cmake/Tools.cmake)
include(cmake/cmake-version4git.cmake)
PROJECT_VERSION_FROM_GIT()
add_definitions(${PROJECT_VERSION4GIT_CFLAGS})
set_build_type()
set_output_binary_name()
set_default_parallel_jobs()
#-------------------------------------------------------------------------------------------
# Add include directories.
#-------------------------------------------------------------------------------------------
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
"addtofullpack_manager/sdk/cssdk/include"
"addtofullpack_manager/sdk/metamod/include"
"addtofullpack_manager/sdk/amxx/include"
"addtofullpack_manager/addtofullpack_manager/include"
)
#-------------------------------------------------------------------------------------------
# Add source files.
#-------------------------------------------------------------------------------------------
find_source_files("addtofullpack_manager/sdk/cssdk/src" sources_list)
find_source_files("addtofullpack_manager/sdk/metamod/src" sources_list)
find_source_files("addtofullpack_manager/sdk/amxx/src" sources_list)
find_source_files("addtofullpack_manager/addtofullpack_manager/src" sources_list)
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${sources_list})
#-------------------------------------------------------------------------------------------
# Set definitions.
#-------------------------------------------------------------------------------------------
include(cmake/Definitions.cmake)
#-------------------------------------------------------------------------------------------
# Set compiler flags.
#-------------------------------------------------------------------------------------------
target_compile_features(${CMAKE_PROJECT_NAME} PUBLIC cxx_std_17)
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
POSITION_INDEPENDENT_CODE ON
VISIBILITY_INLINES_HIDDEN ON
CXX_VISIBILITY_PRESET hidden
INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF
INTERPROCEDURAL_OPTIMIZATION_RELEASE ON
INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL ON
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO OFF
)
if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
include(cmake/GCC.cmake)
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")
include(cmake/Intel.cmake)
endif()