-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
116 lines (103 loc) · 2.75 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
112
113
114
115
116
cmake_minimum_required(VERSION 3.0)
cmake_policy(VERSION 3.0)
project(
fbsdvmcore
VERSION 0.0.0
LANGUAGES C)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
include_directories(
${CMAKE_BINARY_DIR}/lib
lib)
include(CheckIncludeFile)
check_include_file("sys/endian.h" HAVE_SYS_ENDIAN_H)
if(NOT HAVE_SYS_ENDIAN_H)
check_include_file("endian.h" HAVE_ENDIAN_H)
if(NOT HAVE_ENDIAN_H)
message(FATAL_ERROR "Unable to find a working [sys/]endian.h")
endif()
endif()
configure_file(lib/config.h.in lib/config.h)
add_library(
fbsdvmcore
lib/fvc.c
lib/fvc_amd64.c
lib/fvc_arm.c
lib/fvc_i386.c
lib/fvc_minidump_aarch64.c
lib/fvc_minidump_amd64.c
lib/fvc_minidump_arm.c
lib/fvc_minidump_i386.c
lib/fvc_minidump_mips.c
lib/fvc_minidump_powerpc64.c
lib/fvc_minidump_powerpc64_hpt.c
lib/fvc_minidump_riscv.c
lib/fvc_powerpc.c
lib/fvc_powerpc64.c
lib/fvc_private.c
lib/fvc.h
)
set_target_properties(
fbsdvmcore
PROPERTIES
LINK_FLAGS "-Wl,-z,defs"
LINK_LIBRARIES elf
PUBLIC_HEADER "lib/fvc.h"
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}")
add_executable(
minidump-to-elf
src/minidump-to-elf.c)
target_link_libraries(
minidump-to-elf
fbsdvmcore
elf)
set(ENABLE_TESTS ON)
find_program(KYUA kyua)
if(NOT KYUA)
message(WARNING "kyua not found, tests will be disabled")
set(ENABLE_TESTS OFF)
endif()
include(FindPkgConfig)
pkg_check_modules(ATF atf-c)
if(NOT ATF_FOUND)
message(WARNING "atf-c not found, tests will be disabled")
set(ENABLE_TESTS OFF)
else()
string(REPLACE ";" " " ATF_CFLAGS "${ATF_CFLAGS}")
string(REPLACE ";" " " ATF_LDFLAGS "${ATF_LDFLAGS}")
endif()
if(ENABLE_TESTS)
add_subdirectory(tests)
endif()
include(GNUInstallDirs)
install(
TARGETS fbsdvmcore
EXPORT FBSDVMCoreTargets
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(
FILES
man/fbsdvmcore.3
man/fvc_close.3
man/fvc_geterr.3
man/fvc_kerndisp.3
man/fvc_open.3
man/fvc_read.3
DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
install(
EXPORT FBSDVMCoreTargets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/FBSDVMCore")
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/FBSDVMCoreConfig.cmake.in
cmake/FBSDVMCoreConfig.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/FBSDVMCore"
PATH_VARS CMAKE_INSTALL_LIBDIR)
write_basic_package_version_file(
cmake/FBSDVMCoreConfigVersion.cmake
COMPATIBILITY SameMajorVersion)
install(
FILES
"${CMAKE_BINARY_DIR}/cmake/FBSDVMCoreConfig.cmake"
"${CMAKE_BINARY_DIR}/cmake/FBSDVMCoreConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/FBSDVMCore")