osquery-1/CMakeLists.txt

71 lines
1.9 KiB
CMake
Raw Normal View History

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
2014-07-31 00:35:19 +00:00
PROJECT(OSQUERY)
2014-09-05 14:54:41 +00:00
if(APPLE)
2014-09-23 03:40:28 +00:00
set(OS_COMPILE_FLAGS "-std=c++11 -stdlib=libc++")
2014-09-06 01:12:37 +00:00
set(OS_WHOLELINK_PRE "-Wl,-all_load")
set(OS_WHOLELINK_POST "")
2014-09-05 14:54:41 +00:00
else()
set(OS_COMPILE_FLAGS "-std=c++11")
2014-09-06 01:12:37 +00:00
set(OS_WHOLELINK_PRE "-Wl,-whole-archive")
set(OS_WHOLELINK_POST "-Wl,-no-whole-archive")
endif()
if(BUILD_SHARED_LIBS)
2014-09-21 01:53:49 +00:00
set(USER_COMPILE_FLAGS "-fPIC")
else()
# Building/linking statically (no libosquery)
2014-09-23 03:40:28 +00:00
set(USER_COMPILE_FLAGS "-static")
2014-09-05 14:54:41 +00:00
endif()
2014-09-06 01:12:37 +00:00
set(OS_COMPILE_FLAGS "${OS_COMPILE_FLAGS} ${USER_COMPILE_FLAGS}")
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
FIND_PACKAGE(Gtest REQUIRED)
FIND_PACKAGE(Sqlite3 REQUIRED)
2014-09-24 02:44:58 +00:00
FIND_PACKAGE(BZip2 REQUIRED)
FIND_PACKAGE(Boost 1.55.0 REQUIRED)
FIND_PACKAGE(Glog REQUIRED)
FIND_PACKAGE(Gflags REQUIRED)
FIND_PACKAGE(Thrift 0.9.1 REQUIRED)
FIND_PACKAGE(Readline REQUIRED)
FIND_PACKAGE(OpenSSL REQUIRED)
FIND_PACKAGE(Threads REQUIRED)
FIND_PACKAGE(Snappy REQUIRED)
FIND_PACKAGE(RocksDB REQUIRED)
FIND_PACKAGE(Crypto REQUIRED)
FIND_PACKAGE(Dl REQUIRED)
if(NOT APPLE)
FIND_PACKAGE(Unwind REQUIRED)
FIND_PACKAGE(LZMA REQUIRED)
endif()
2014-09-06 01:12:37 +00:00
2014-09-24 05:06:32 +00:00
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include")
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}")
INCLUDE_DIRECTORIES("/usr/local/include")
LINK_DIRECTORIES("/usr/local/lib")
ENABLE_TESTING()
ADD_SUBDIRECTORY(osquery)
ADD_SUBDIRECTORY(tools)
2014-09-24 03:12:53 +00:00
# make docs
FIND_PACKAGE(Doxygen)
if(DOXYGEN_FOUND)
ADD_CUSTOM_TARGET(
docs
${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
2014-09-24 06:38:23 +00:00
# make format
ADD_CUSTOM_TARGET(
format
find osquery include tools \( -name "*.h" -o -name "*.cpp" -o -name "*.mm" \) -exec clang-format -i {} +
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Formatting code with clang-format" VERBATIM
)