-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
75 lines (60 loc) · 2.23 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
cmake_minimum_required(VERSION 3.7)
project(rvncorevirtualbox)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
option(BUILD_SHARED_LIBS "Set to ON to build shared libraries; OFF for static libraries." OFF)
option(WARNING_AS_ERROR "Set to ON to build with -Werror" ON)
option(BUILD_TEST_COVERAGE "Set to ON to build while generating coverage information. Will put source on the build directory." OFF)
add_library(rvncorevirtualbox
src/core_virtualbox.cpp
src/cpu_virtualbox.cpp
src/memory_chunk.cpp
src/memory_virtualbox.cpp
src/physical_memory.cpp
)
target_compile_options(rvncorevirtualbox PRIVATE -W -Wall -Wextra -Wmissing-include-dirs -Wunknown-pragmas -Wpointer-arith -Wmissing-field-initializers -Wno-multichar -Wreturn-type)
if(WARNING_AS_ERROR)
target_compile_options(rvncorevirtualbox PRIVATE -Werror)
endif()
if(BUILD_TEST_COVERAGE)
target_compile_options(rvncorevirtualbox PRIVATE -g -O0 --coverage -fprofile-arcs -ftest-coverage)
target_link_libraries(rvncorevirtualbox PRIVATE gcov)
endif()
target_include_directories(rvncorevirtualbox
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
set(PUBLIC_HEADERS
include/core_virtualbox.h
include/core_virtualbox_def.h
include/cpu_virtualbox.h
include/memory_chunk.h
include/memory_virtualbox.h
include/physical_memory.h
)
set_target_properties(rvncorevirtualbox PROPERTIES
PUBLIC_HEADER "${PUBLIC_HEADERS}"
POSITION_INDEPENDENT_CODE ON
)
include(GNUInstallDirs)
install(TARGETS rvncorevirtualbox
EXPORT rvncorevirtualbox-export
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
)
install(EXPORT rvncorevirtualbox-export
FILE
rvncorevirtualbox-config.cmake
DESTINATION
${CMAKE_INSTALL_DATADIR}/cmake/rvncorevirtualbox
)
add_subdirectory(bin)
enable_testing()
add_subdirectory(test)