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
|
|
|
function(osqueryUtilsConversionsMain)
|
|
|
|
if(BUILD_TESTING)
|
|
|
|
generateOsqueryUtilsConversionsConversionstestsTest()
|
|
|
|
generateOsqueryUtilsConversionsTotestsTest()
|
|
|
|
endif()
|
2018-11-30 01:27:21 +00:00
|
|
|
|
|
|
|
generateOsqueryUtilsConversions()
|
2019-06-25 08:50:43 +00:00
|
|
|
generateOsqueryUtilsConversionsTo()
|
2018-11-30 01:27:21 +00:00
|
|
|
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()
|
|
|
|
|
2019-06-25 08:50:43 +00:00
|
|
|
add_osquery_library(osquery_utils_conversions EXCLUDE_FROM_ALL
|
2018-11-30 01:27:21 +00:00
|
|
|
${source_files}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(osquery_utils_conversions PUBLIC
|
|
|
|
global_cxx_settings
|
2019-06-25 08:50:43 +00:00
|
|
|
osquery_utils_conversions_to
|
2018-11-30 01:27:21 +00:00
|
|
|
osquery_utils_expected
|
|
|
|
thirdparty_boost
|
|
|
|
thirdparty_glog
|
|
|
|
)
|
|
|
|
|
|
|
|
set(public_header_files
|
2019-06-25 08:50:43 +00:00
|
|
|
castvariant.h
|
2018-11-30 01:27:21 +00:00
|
|
|
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()
|
2019-06-25 08:50:43 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
)
|
2018-11-30 01:27:21 +00:00
|
|
|
endfunction()
|
|
|
|
|
2019-06-25 08:50:43 +00:00
|
|
|
osqueryUtilsConversionsMain()
|