forked from osquery/osquery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
148 lines (121 loc) · 3.26 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Copyright (c) 2014-present, The osquery authors
#
# This source code is licensed as defined by the LICENSE file found in the
# root directory of this source tree.
#
# SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only)
function(osqueryFilesystemMain)
if(OSQUERY_BUILD_TESTS)
generateOsqueryFilesystemTest()
endif()
generateOsqueryFilesystem()
generateOsqueryFilesystemMockfilestructure()
endfunction()
function(generateOsqueryFilesystem)
set(source_files
file_compression.cpp
filesystem.cpp
)
set(public_header_files
fileops.h
filesystem.h
)
if(DEFINED PLATFORM_MACOS)
list(APPEND source_files
darwin/bsd_file_flags.cpp
)
endif()
if(DEFINED PLATFORM_POSIX)
list(APPEND source_files
posix/fileops.cpp
posix/xattrs.cpp
)
list(APPEND public_header_files
posix/xattrs.h
)
endif()
if(DEFINED PLATFORM_LINUX)
list(APPEND source_files
linux/mem.cpp
linux/proc.cpp
linux/mounts.cpp
)
elseif(DEFINED PLATFORM_WINDOWS)
list(APPEND source_files
windows/fileops.cpp
)
endif()
add_osquery_library(osquery_filesystem EXCLUDE_FROM_ALL
${source_files}
)
target_link_libraries(osquery_filesystem PUBLIC
osquery_cxx_settings
osquery_process
osquery_sql
osquery_utils_conversions
osquery_utils_status
osquery_utils_system_env
osquery_utils_system_filepath
thirdparty_boost
thirdparty_libarchive
thirdparty_zstd
)
if(DEFINED PLATFORM_LINUX)
list(APPEND public_header_files
linux/proc.h
linux/mounts.h
)
endif()
generateIncludeNamespace(osquery_filesystem "osquery/filesystem" "FULL_PATH" ${public_header_files})
add_test(NAME osquery_filesystem_filesystemtests-test COMMAND osquery_filesystem_filesystemtests-test)
set_tests_properties(
osquery_filesystem_filesystemtests-test
PROPERTIES ENVIRONMENT "TEST_CONF_FILES_DIR=${TEST_CONFIGS_DIR}"
)
endfunction()
function(generateOsqueryFilesystemMockfilestructure)
add_osquery_library(osquery_filesystem_mockfilestructure EXCLUDE_FROM_ALL
mock_file_structure.cpp
)
target_link_libraries(osquery_filesystem_mockfilestructure PUBLIC
osquery_cxx_settings
thirdparty_boost
osquery_filesystem
)
set(public_header_files
mock_file_structure.h
)
generateIncludeNamespace(osquery_filesystem_mockfilestructure "osquery/filesystem" "FILE_ONLY" ${public_header_files})
endfunction()
function(generateOsqueryFilesystemTest)
set(source_files
tests/fileops.cpp
tests/filesystem.cpp
)
if(DEFINED PLATFORM_POSIX)
list(APPEND source_files
tests/posix/xattrs.cpp
)
endif()
if(DEFINED PLATFORM_MACOS)
list(APPEND source_files
tests/darwin/plist_tests.cpp
tests/darwin/bsd_file_flags_tests.cpp
)
endif()
add_osquery_executable(osquery_filesystem_filesystemtests-test ${source_files})
target_link_libraries(osquery_filesystem_filesystemtests-test PRIVATE
osquery_cxx_settings
osquery_config_tests_testutils
osquery_core
osquery_extensions
osquery_extensions_implthrift
osquery_process
osquery_registry
osquery_filesystem_mockfilestructure
osquery_filesystem
tests_helper
thirdparty_googletest
)
endfunction()
osqueryFilesystemMain()