2014-09-06 01:12:37 +00:00
|
|
|
SET(OSQUERY_LIBS
|
|
|
|
gflags
|
|
|
|
glog
|
|
|
|
gtest
|
|
|
|
|
|
|
|
bz2
|
|
|
|
readline
|
|
|
|
rocksdb
|
|
|
|
snappy
|
2014-09-12 04:44:10 +00:00
|
|
|
thrift
|
2014-09-06 01:12:37 +00:00
|
|
|
z
|
|
|
|
|
|
|
|
boost_system
|
|
|
|
boost_filesystem
|
|
|
|
boost_program_options
|
|
|
|
|
|
|
|
# For SQLite pthread, dl
|
|
|
|
pthread
|
|
|
|
dl
|
|
|
|
)
|
|
|
|
|
|
|
|
# Handle naming differences in MT threading
|
|
|
|
if(APPLE)
|
|
|
|
list(APPEND OSQUERY_LIBS "boost_thread-mt")
|
|
|
|
else()
|
|
|
|
list(APPEND OSQUERY_LIBS "boost_thread")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Fill this in with objects for libosquery
|
|
|
|
set(OSQUERY_LIB_ADDITIONAL_OBJECTS "")
|
|
|
|
set(OSQUERY_ADDITIONAL_LINKS "")
|
|
|
|
|
|
|
|
MACRO(ADD_OSQUERY_LIB TARGET)
|
|
|
|
list(APPEND OSQUERY_LIB_ADDITIONAL_OBJECTS ${TARGET})
|
2014-09-07 00:29:56 +00:00
|
|
|
set(OSQUERY_LIB_ADDITIONAL_OBJECTS ${OSQUERY_LIB_ADDITIONAL_OBJECTS}
|
2014-09-06 01:12:37 +00:00
|
|
|
PARENT_SCOPE)
|
|
|
|
ENDMACRO(ADD_OSQUERY_LIB)
|
|
|
|
|
|
|
|
MACRO(ADD_OSQUERY_LINK LINK)
|
|
|
|
list(APPEND OSQUERY_ADDITIONAL_LINKS ${LINK})
|
2014-09-07 00:29:56 +00:00
|
|
|
set(OSQUERY_ADDITIONAL_LINKS ${OSQUERY_ADDITIONAL_LINKS}
|
2014-09-06 01:12:37 +00:00
|
|
|
PARENT_SCOPE)
|
|
|
|
ENDMACRO(ADD_OSQUERY_LINK)
|
|
|
|
|
|
|
|
MACRO(SET_OSQUERY_COMPILE TARGET)
|
|
|
|
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS ${OS_COMPILE_FLAGS})
|
|
|
|
SET(OPTIONAL_FLAGS ${ARGN})
|
|
|
|
LIST(LENGTH OPTIONAL_FLAGS NUM_OPTIONAL_FLAGS)
|
|
|
|
if(${NUM_OPTIONAL_FLAGS} GREATER 0)
|
|
|
|
MESSAGE("Notice: Adding compile flags ${OPTIONAL_FLAGS} to ${TARGET}")
|
|
|
|
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS ${OPTIONAL_FLAGS})
|
|
|
|
ENDIF()
|
|
|
|
ENDMACRO(SET_OSQUERY_COMPILE)
|
|
|
|
|
|
|
|
MACRO(ADD_OSQUERY_TEST TEST_NAME SOURCE LINK)
|
|
|
|
ADD_EXECUTABLE(${TEST_NAME} ${SOURCE})
|
|
|
|
TARGET_LINK_LIBRARIES(${TEST_NAME} ${LINK})
|
|
|
|
TARGET_LINK_LIBRARIES(${TEST_NAME} ${OSQUERY_ADDITIONAL_LINKS})
|
|
|
|
TARGET_LINK_LIBRARIES(${TEST_NAME} ${OSQUERY_LIBS})
|
|
|
|
SET(OPTIONAL_FLAGS ${ARGN})
|
|
|
|
SET_OSQUERY_COMPILE(${TEST_NAME} ${OPTIONAL_FLAGS})
|
|
|
|
ADD_TEST(${TEST_NAME} ${TEST_NAME})
|
|
|
|
ENDMACRO(ADD_OSQUERY_TEST)
|
|
|
|
|
2014-09-10 04:37:08 +00:00
|
|
|
MACRO(ADD_OSQUERY_EXECUTABLE NAME SOURCE)
|
|
|
|
ADD_OSQUERY_TEST(${NAME} ${SOURCE})
|
|
|
|
TARGET_LINK_LIBRARIES(${NAME} osquery_shared)
|
|
|
|
ENDMACRO(ADD_OSQUERY_EXECUTABLE)
|
|
|
|
|
2014-09-06 01:12:37 +00:00
|
|
|
MACRO(TARGET_OSQUERY_LINK_WHOLE TARGET OSQUERY_LIB)
|
|
|
|
TARGET_LINK_LIBRARIES(${TARGET} "${OS_WHOLELINK_PRE}")
|
|
|
|
TARGET_LINK_LIBRARIES(${TARGET} ${OSQUERY_LIB})
|
2014-09-07 00:29:56 +00:00
|
|
|
TARGET_LINK_LIBRARIES(${TARGET} "${OS_WHOLELINK_POST}")
|
2014-09-06 01:12:37 +00:00
|
|
|
ENDMACRO(TARGET_OSQUERY_LINK_WHOLE)
|
|
|
|
|
2014-09-02 08:00:58 +00:00
|
|
|
ADD_SUBDIRECTORY(config)
|
|
|
|
ADD_SUBDIRECTORY(core)
|
|
|
|
ADD_SUBDIRECTORY(database)
|
|
|
|
ADD_SUBDIRECTORY(devtools)
|
2014-09-04 06:46:24 +00:00
|
|
|
ADD_SUBDIRECTORY(examples)
|
2014-09-02 08:00:58 +00:00
|
|
|
ADD_SUBDIRECTORY(filesystem)
|
|
|
|
ADD_SUBDIRECTORY(logger)
|
2014-09-12 04:44:10 +00:00
|
|
|
ADD_SUBDIRECTORY(dispatcher)
|
2014-09-06 01:12:37 +00:00
|
|
|
ADD_SUBDIRECTORY(registry)
|
2014-09-02 08:00:58 +00:00
|
|
|
ADD_SUBDIRECTORY(scheduler)
|
|
|
|
ADD_SUBDIRECTORY(tables)
|
|
|
|
|
2014-09-06 01:12:37 +00:00
|
|
|
SET(OSQUERY_LIB_OBJECTS
|
|
|
|
$<TARGET_OBJECTS:osquery_config>
|
|
|
|
$<TARGET_OBJECTS:osquery_core>
|
|
|
|
$<TARGET_OBJECTS:osquery_database>
|
|
|
|
$<TARGET_OBJECTS:osquery_devtools>
|
|
|
|
|
|
|
|
$<TARGET_OBJECTS:osquery_filesystem>
|
|
|
|
$<TARGET_OBJECTS:osquery_logger>
|
|
|
|
$<TARGET_OBJECTS:osquery_registry>
|
|
|
|
$<TARGET_OBJECTS:osquery_scheduler>
|
2014-09-12 04:44:10 +00:00
|
|
|
$<TARGET_OBJECTS:osquery_dispatcher>
|
2014-09-06 01:12:37 +00:00
|
|
|
|
|
|
|
# Optional "core" tables objects
|
|
|
|
$<TARGET_OBJECTS:osquery_tables>
|
|
|
|
|
|
|
|
# Third-party objects
|
|
|
|
$<TARGET_OBJECTS:osquery_sqlite>
|
|
|
|
|
|
|
|
# Build additional os-dependent libraries (may include tables)
|
|
|
|
${OSQUERY_LIB_ADDITIONAL_OBJECTS}
|
2014-09-02 08:00:58 +00:00
|
|
|
)
|
|
|
|
|
2014-09-21 01:53:49 +00:00
|
|
|
if(DONT_BUILD_SHARED)
|
2014-09-06 01:12:37 +00:00
|
|
|
ADD_LIBRARY(osquery_static STATIC ${OSQUERY_LIB_OBJECTS})
|
|
|
|
SET_TARGET_PROPERTIES(osquery_static PROPERTIES OUTPUT_NAME osquery_static)
|
|
|
|
|
2014-09-12 16:39:43 +00:00
|
|
|
ADD_LIBRARY(osquery_shared STATIC main/lib.cpp)
|
2014-09-06 01:12:37 +00:00
|
|
|
TARGET_OSQUERY_LINK_WHOLE(osquery_shared osquery_static)
|
2014-09-21 01:53:49 +00:00
|
|
|
else()
|
|
|
|
ADD_LIBRARY(osquery_shared SHARED main/lib.cpp ${OSQUERY_LIB_OBJECTS})
|
|
|
|
INSTALL(TARGETS osquery_shared DESTINATION lib)
|
2014-09-06 01:12:37 +00:00
|
|
|
endif()
|
|
|
|
ADD_DEPENDENCIES(osquery_shared librocksdb)
|
|
|
|
TARGET_LINK_LIBRARIES(osquery_shared ${OSQUERY_ADDITIONAL_LINKS})
|
|
|
|
TARGET_LINK_LIBRARIES(osquery_shared ${OSQUERY_LIBS})
|
|
|
|
SET_TARGET_PROPERTIES(osquery_shared PROPERTIES OUTPUT_NAME osquery)
|
2014-09-02 08:00:58 +00:00
|
|
|
|
|
|
|
ADD_EXECUTABLE(shell main/shell.cpp)
|
2014-09-06 01:12:37 +00:00
|
|
|
TARGET_LINK_LIBRARIES(shell osquery_shared)
|
2014-09-02 08:00:58 +00:00
|
|
|
SET_TARGET_PROPERTIES(shell PROPERTIES OUTPUT_NAME osqueryi)
|
2014-09-05 14:54:41 +00:00
|
|
|
SET_TARGET_PROPERTIES(shell PROPERTIES COMPILE_FLAGS ${OS_COMPILE_FLAGS})
|
2014-09-02 08:00:58 +00:00
|
|
|
INSTALL(TARGETS shell DESTINATION bin)
|
|
|
|
|
|
|
|
ADD_EXECUTABLE(daemon main/daemon.cpp)
|
2014-09-06 01:12:37 +00:00
|
|
|
TARGET_LINK_LIBRARIES(daemon osquery_shared)
|
2014-09-02 08:00:58 +00:00
|
|
|
SET_TARGET_PROPERTIES(daemon PROPERTIES OUTPUT_NAME osqueryd)
|
2014-09-05 14:54:41 +00:00
|
|
|
SET_TARGET_PROPERTIES(daemon PROPERTIES COMPILE_FLAGS ${OS_COMPILE_FLAGS})
|
2014-09-02 08:00:58 +00:00
|
|
|
INSTALL(TARGETS daemon DESTINATION bin)
|