-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·111 lines (95 loc) · 3.06 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
108
109
110
111
#cmake version
cmake_minimum_required(VERSION 3.12...3.15)
if(NOT TARGET ${RamRodNetwork_LIBRARIES})
project(RamRodNetwork
VERSION 0.8.0
DESCRIPTION "Ram-Rod's Network communication library"
LANGUAGES CXX C
)
set(${PROJECT_NAME}_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/include
CACHE INTERNAL ""
)
set(${PROJECT_NAME}_LIBRARIES
${PROJECT_NAME}
CACHE INTERNAL ""
)
# +++++++++++++++++++++++++++++++++++++ Console printer ++++++++++++++++++++++++++++++++++++
# adding the root directory of torero source tree to your project
add_subdirectory(lib/ramrod/console_printer)
#add every file to the executable
add_library(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED TRUE
CXX_EXTENSIONS FALSE
)
target_sources(${PROJECT_NAME}
PRIVATE
src/ramrod/network_communication/conversor.cpp
src/ramrod/network_communication/client.cpp
src/ramrod/network_communication/server.cpp
)
target_include_directories(${PROJECT_NAME} BEFORE
PRIVATE
include
${RamRodConsole_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}
${RamRodConsole_LIBRARIES}
pthread
)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
if(CMAKE_BUILD_TYPE MATCHES Debug)
# Allows the program to print in console/terminal detailed error's explanations
target_compile_definitions(${PROJECT_NAME}
PRIVATE
VERBOSE=True
)
# TODO: delete this after finishing code
message(WARNING "Compiling warnings in debug mode: ${CMAKE_BUILD_TYPE}")
target_compile_options(${PROJECT_NAME}
PRIVATE
-Wall
-Wextra
-Wundef
-Wpedantic
-Wconversion
-Wcast-align
-Wfloat-equal
-Wpointer-arith
-Wsign-conversion
-Wunreachable-code
-Wunused-function
-Wignored-qualifiers
)
##########################
## include-what-you-use ##
##########################
if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
find_program(iwyu_path NAMES include-what-you-use iwyu)
if(NOT iwyu_path)
message(FATAL_ERROR "Could not find the program include-what-you-use")
else()
message(STATUS "include-what-you-use found: ${iwyu_path}")
get_filename_component(PARENT_DIR ${iwyu_path} DIRECTORY)
get_filename_component(G_PARENT_DIR ${PARENT_DIR} DIRECTORY)
set(iwyu_share_path ${G_PARENT_DIR}/share/include-what-you-use)
message("iwyu share path: ${iwyu_share_path}")
set(iwyu_path_and_options
${iwyu_path}
-Xiwyu
--mapping_file=${iwyu_share_path}/boost-all.imp
-Xiwyu
--mapping_file=${iwyu_share_path}/boost-all-private.imp
)
set_target_properties(
${PROJECT_NAME}
PROPERTIES
CXX_INCLUDE_WHAT_YOU_USE
"${iwyu_path_and_options}"
)
endif(NOT iwyu_path)
endif(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
endif(CMAKE_BUILD_TYPE MATCHES Debug)
endif(NOT TARGET ${RamRodNetwork_LIBRARIES})