-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
92 lines (75 loc) · 2.6 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
# ==============================================================================
# CMakeLists.txt
#
# Copyright (C) 2019 xcp-emu-manager
# Copyright (C) 2019 Vates SAS
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# ==============================================================================
cmake_minimum_required(VERSION 3.13.1)
# ------------------------------------------------------------------------------
# Config & flags.
# ------------------------------------------------------------------------------
project(xcp-emu-manager VERSION 1.2.0 LANGUAGES C)
set(CMAKE_C_STANDARD 11)
set(XCP_EMU_MANAGER_BIN emu-manager)
set(CUSTOM_C_FLAGS
-Wall
-Wcast-align
-Wconversion
-Werror
-Wextra
-Wfloat-equal
-Wformat-nonliteral
-Wpointer-arith
-Wsign-conversion
)
if (CMAKE_C_COMPILER_ID MATCHES "GNU")
list(APPEND CUSTOM_C_FLAGS
-Wlogical-op
)
endif ()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
find_package(Emp REQUIRED)
find_package(JsonC REQUIRED)
find_package(XcpNgGeneric 1.1.0 REQUIRED)
set(LIBS
Emp::Emp
JsonC::JsonC
XcpNg::Generic
)
# ------------------------------------------------------------------------------
# Sources.
# ------------------------------------------------------------------------------
set(SOURCES
src/arg-list.c
src/control.c
src/emu-client.c
src/emu.c
src/main.c
src/qmp.c
)
# ------------------------------------------------------------------------------
# Binary.
# ------------------------------------------------------------------------------
add_compile_options(${CUSTOM_C_FLAGS})
add_executable(${XCP_EMU_MANAGER_BIN} ${SOURCES})
set_property(TARGET ${XCP_EMU_MANAGER_BIN} PROPERTY LINKER_LANGUAGE C)
target_link_libraries(${XCP_EMU_MANAGER_BIN} PRIVATE ${LIBS})
include(GNUInstallDirs)
install(TARGETS ${XCP_EMU_MANAGER_BIN}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/xen/bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)