osquery-1/osquery/CMakeLists.txt
Stefano Bonicatti 942878854b Add CMake support
Taken from osql-experimental.

- Change CMake code license to the one present in osquery right now

- Package metadata doesn't mention Trail of Bits or osql anymore

- Set specific ACLs for the osqueryd on Windows when packaging

- Remove LLVM_INSTALL_PATH support on macOS, since we are using AppleClang

- Remove OSQUERY_SOURCE_DIR variable need and source in a submodule support

- Add targets format_check and format to check code formatting and
  format it with clang-format

- Do not warn about not using Clang on macOS when using AppleClang
2019-06-26 21:49:06 -04:00

71 lines
2.1 KiB
CMake

# Copyright (c) 2014-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
function(osqueryMain)
add_subdirectory("process")
add_subdirectory("profiler")
add_subdirectory("dispatcher")
add_subdirectory("sql")
add_subdirectory("sdk")
add_subdirectory("numeric_monitoring")
add_subdirectory("killswitch")
add_subdirectory("registry")
add_subdirectory("logger")
add_subdirectory("distributed")
add_subdirectory("carver")
add_subdirectory("tables")
add_subdirectory("hashing")
add_subdirectory("remote")
add_subdirectory("core")
add_subdirectory("config")
add_subdirectory("utils")
add_subdirectory("filesystem")
add_subdirectory("database")
add_subdirectory("main")
add_subdirectory("devtools")
add_subdirectory("extensions")
add_subdirectory("events")
add_subdirectory("ev2")
add_subdirectory("experimental")
add_subdirectory("system")
generateOsqueryHeaders()
generateOsqueryd()
endfunction()
function(generateOsqueryHeaders)
add_osquery_library(osquery_headers INTERFACE)
target_include_directories(osquery_headers INTERFACE "${CMAKE_SOURCE_DIR}/osquery/include")
target_link_libraries(osquery_headers INTERFACE
global_cxx_settings
osquery_core_plugins
osquery_utils_info
osquery_utils_macros
osquery_utils_system_systemutils
thirdparty_gflags
thirdparty_sqlite
thirdparty_googletest_headers
)
endfunction()
function(generateOsqueryd)
# Upstream uses an empty executable that links to a library with a
# a main() entry point; try to emulate this.
set(source_file "${CMAKE_CURRENT_BINARY_DIR}/empty_osqueryd_target_source_file.cpp")
generateBuildTimeSourceFile(${source_file} "extern int main(int argc, char* argv[]);")
add_osquery_executable(osqueryd "${source_file}")
set_target_properties(osqueryd PROPERTIES POSITION_INDEPENDENT_CODE true)
target_link_libraries(osqueryd PRIVATE
global_cxx_settings
osquery_main
)
endfunction()
osqueryMain()