2019-06-25 08:50:43 +00:00
|
|
|
# Copyright (c) 2014-present, Facebook, Inc.
|
|
|
|
# All rights reserved.
|
2018-11-30 01:27:21 +00:00
|
|
|
#
|
2019-06-25 08:50:43 +00:00
|
|
|
# This source code is licensed in accordance with the terms specified in
|
|
|
|
# the LICENSE file found in the root directory of this source tree.
|
2018-11-30 01:27:21 +00:00
|
|
|
|
2019-06-25 08:50:43 +00:00
|
|
|
cmake_minimum_required(VERSION 3.13.3)
|
2018-11-30 01:27:21 +00:00
|
|
|
project(osquery)
|
|
|
|
|
2019-06-25 08:50:43 +00:00
|
|
|
if(BUILD_TESTING)
|
|
|
|
enable_testing()
|
|
|
|
endif()
|
|
|
|
|
2018-11-30 01:27:21 +00:00
|
|
|
include(cmake/globals.cmake)
|
|
|
|
include(cmake/utilities.cmake)
|
|
|
|
include(cmake/options.cmake)
|
2019-06-25 08:50:43 +00:00
|
|
|
include(cmake/packaging.cmake)
|
2018-11-30 01:27:21 +00:00
|
|
|
|
|
|
|
function(main)
|
|
|
|
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
|
|
|
message(STATUS "Shared libraries: ${BUILD_SHARED_LIBS}")
|
|
|
|
|
2019-06-25 08:50:43 +00:00
|
|
|
if(DEFINED PLATFORM_MACOS)
|
|
|
|
if((NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang") OR
|
|
|
|
(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))
|
|
|
|
message(STATUS "Warning: the selected C or C++ compiler is not clang/clang++. Compilation may fail")
|
|
|
|
endif()
|
|
|
|
elseif(NOT DEFINED PLATFORM_WINDOWS)
|
|
|
|
if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
|
|
|
|
NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
message(STATUS "Warning: the selected C or C++ compiler is not clang/clang++. Compilation may fail")
|
|
|
|
endif()
|
2018-11-30 01:27:21 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
generateGlobalSettingsTargets()
|
|
|
|
|
2019-06-25 08:50:43 +00:00
|
|
|
findPythonExecutablePath()
|
|
|
|
generateSpecialTargets()
|
|
|
|
|
2018-11-30 01:27:21 +00:00
|
|
|
add_subdirectory("third-party")
|
|
|
|
add_subdirectory("osquery")
|
2019-06-25 08:50:43 +00:00
|
|
|
add_subdirectory("plugins")
|
2018-11-30 01:27:21 +00:00
|
|
|
add_subdirectory("tools")
|
|
|
|
add_subdirectory("specs")
|
|
|
|
|
2019-06-25 08:50:43 +00:00
|
|
|
if(BUILD_TESTING)
|
|
|
|
add_subdirectory("tests")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
identifyPackagingSystem()
|
|
|
|
generateInstallTargets()
|
|
|
|
generatePackageTarget()
|
|
|
|
|
2018-11-30 01:27:21 +00:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
main()
|