osquery-1/osquery/utils/conversions/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

126 lines
3.2 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(osqueryUtilsConversionsMain)
if(BUILD_TESTING)
generateOsqueryUtilsConversionsConversionstestsTest()
generateOsqueryUtilsConversionsTotestsTest()
endif()
generateOsqueryUtilsConversions()
generateOsqueryUtilsConversionsTo()
endfunction()
function(generateOsqueryUtilsConversions)
set(source_files
split.cpp
tryto.cpp
)
if(DEFINED PLATFORM_MACOS)
list(APPEND source_files
darwin/cfdata.cpp
darwin/cfnumber.cpp
darwin/cfstring.cpp
darwin/cftime.cpp
darwin/iokit.cpp
)
elseif(DEFINED PLATFORM_WINDOWS)
list(APPEND source_files
windows/strings.cpp
)
endif()
add_osquery_library(osquery_utils_conversions EXCLUDE_FROM_ALL
${source_files}
)
target_link_libraries(osquery_utils_conversions PUBLIC
global_cxx_settings
osquery_utils_conversions_to
osquery_utils_expected
thirdparty_boost
thirdparty_glog
)
set(public_header_files
castvariant.h
join.h
split.h
tryto.h
)
generateIncludeNamespace(osquery_utils_conversions "osquery/utils/conversions" "FILE_ONLY" ${public_header_files})
if(DEFINED PLATFORM_MACOS)
set(platform_public_header_files
darwin/cfdata.h
darwin/cfnumber.h
darwin/cfstring.h
darwin/cftime.h
darwin/iokit.h
)
elseif(DEFINED PLATFORM_WINDOWS)
set(platform_public_header_files
windows/strings.h
)
endif()
list(LENGTH platform_public_header_files platform_public_header_files_size)
if(${platform_public_header_files_size} GREATER 0)
generateIncludeNamespace(osquery_utils_conversions "osquery/utils/conversions" "FULL_PATH" ${platform_public_header_files})
endif()
add_test(NAME osquery_utils_conversions_conversionstests-test COMMAND osquery_utils_conversions_conversionstests-test)
endfunction()
function(generateOsqueryUtilsConversionsTo)
add_osquery_library(osquery_utils_conversions_to INTERFACE)
set(public_header_files
to.h
)
target_link_libraries(osquery_utils_conversions_to INTERFACE thirdparty_boost)
generateIncludeNamespace(osquery_utils_conversions_to "osquery/utils/conversions" "FILE_ONLY" ${public_header_files})
add_test(NAME osquery_utils_conversions_totests-test COMMAND osquery_utils_conversions_totests-test)
endfunction()
function(generateOsqueryUtilsConversionsConversionstestsTest)
set(source_files
tests/join.cpp
tests/split.cpp
tests/tryto.cpp
)
add_osquery_executable(osquery_utils_conversions_conversionstests-test ${source_files})
target_link_libraries(osquery_utils_conversions_conversionstests-test PRIVATE
global_cxx_settings
osquery_utils_conversions
thirdparty_googletest
)
endfunction()
function(generateOsqueryUtilsConversionsTotestsTest)
add_osquery_executable(osquery_utils_conversions_totests-test tests/to.cpp)
target_link_libraries(osquery_utils_conversions_totests-test PRIVATE
global_cxx_settings
osquery_utils_conversions_to
thirdparty_googletest
)
endfunction()
osqueryUtilsConversionsMain()