-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·99 lines (82 loc) · 4.76 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
cmake_minimum_required(VERSION 3.7)
project(Producer_Consumer)
set(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_CXX_COMPILER /usr/bin/g++)
# It sets default to Release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "CMake Build Type: ${CMAKE_BUILD_TYPE}")
else()
message(STATUS "CMake Build Type: ${CMAKE_BUILD_TYPE}")
endif()
# It defines the common flags to all compilation builds no matter the mode
# https://caiorss.github.io/C-Cpp-Notes/compiler-flags-options.html
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wextra -Wall -Wpedantic -fpic")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} \
-g -fprofile-arcs -ftest-coverage -rdynamic \
-g -O0 -Wshadow -Wunused-parameter -Wunused-variable -Wdelete-non-virtual-dtor -Wfatal-errors \
-Woverloaded-virtual -Wunreachable-code -Wno-unused -Wundef -Wl,--no-undefined -Wl,--no-allow-shlib-undefined")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -w -Wl,--discard-all")
#-----------------------------------------------------------------------------
# It defines Cmake supporting scripts path available.
#-----------------------------------------------------------------------------
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
#-----------------------------------------------------------------------------
# It includes CMake application config supporting script.
#-----------------------------------------------------------------------------
include(ApplicationConfigFile)
# It removes the prefix "lib" from the .so and .a files
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_STATIC_LIBRARY_PREFIX "")
# Application's modules prefix
set(APPLICATION_MODULE_PREFIX IPC)
#-----------------------------------------------------------------------------
# Put the libaries and binaries built into directories at the
# top of the build tree rather than in hard-to-find leaf directories.
# This simplifies manual testing and the use of the build tree.
#-----------------------------------------------------------------------------
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin)
#-----------------------------------------------------------------------------
# It defines the structure of the application after installation
#
# - /usr/local/bin/ executable binaries (i.e., Consumer_Management, ConsumerDaemon)
# - /usr/local/lib/[ application directory name]/ all library binary files
# - /usr/local/etc/[ application directory name]/ system configurations for local binaries
# - /usr/local/share/[application directory name]/ local architecture-independent hierarchy files (i.e., XML files)
#
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# It defines the application's root directory name from the configuration file.
#
# See.: data/settings/application.txt
#-----------------------------------------------------------------------------
string(TOLOWER ${installation_directory_name} APPLICATION_INSTALLATION_DIRECTORY_NAME)
set(APPLICATION_BINARY_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)
set(APPLICATION_CONFIG_DIRECTORY ${CMAKE_INSTALL_PREFIX}/etc/${APPLICATION_INSTALLATION_DIRECTORY_NAME})
set(APPLICATION_LIBRARY_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/${APPLICATION_INSTALLATION_DIRECTORY_NAME})
set(APPLICATION_SHARE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/${APPLICATION_INSTALLATION_DIRECTORY_NAME})
# Add the application library directory to PATH
set(CMAKE_INSTALL_RPATH ${APPLICATION_LIBRARY_DIRECTORY})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
#-----------------------------------------------------------------------------
# Application optional features
#-----------------------------------------------------------------------------
set(ENABLE_TESTS
"Set to OFF|ON (default: ON) to control build of EPP API tests" ON)
#-----------------------------------------------------------------------------
# Add application modules
#-----------------------------------------------------------------------------
add_subdirectory(Foundation)
add_subdirectory(ConsumerDaemon)
add_subdirectory(Consumer)
add_subdirectory(Producer)
#-----------------------------------------------------------------------------
# It configures documentation
#-----------------------------------------------------------------------------
include(DocumentationSettings)
#-----------------------------------------------------------------------------
# Configuration and supporting files installation
#-----------------------------------------------------------------------------
include(ConfigFilesInstallation)