From 1f12b0d8e8527bc8b7ad1bcada82c0a195f57ed9 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 23 Feb 2022 15:01:53 +0300 Subject: [PATCH] Allow folly usages only if TD_TEST_FOLLY is defined. --- benchmark/CMakeLists.txt | 26 ++++++++++++++------------ tdutils/CMakeLists.txt | 14 ++++++++------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 76c28a6c9..6e981abc0 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -73,19 +73,21 @@ if (NOT WIN32 AND NOT CYGWIN) target_link_libraries(bench_queue PRIVATE tdutils) endif() -find_package(ABSL QUIET) -find_package(folly QUIET) -find_package(gflags QUIET) +if (TD_TEST_FOLLY) + find_package(ABSL QUIET) + find_package(folly QUIET) + find_package(gflags QUIET) -if (ABSL_FOUND AND folly_FOUND) - add_executable(memory-hashset-memprof EXCLUDE_FROM_ALL hashset_memory.cpp) - target_compile_definitions(memory-hashset-memprof PRIVATE USE_MEMPROF=1) - target_link_libraries(memory-hashset-memprof PRIVATE tdutils memprof_stat Folly::folly absl::flat_hash_map absl::hash) + if (ABSL_FOUND AND folly_FOUND) + add_executable(memory-hashset-memprof EXCLUDE_FROM_ALL hashset_memory.cpp) + target_compile_definitions(memory-hashset-memprof PRIVATE USE_MEMPROF=1) + target_link_libraries(memory-hashset-memprof PRIVATE tdutils memprof_stat Folly::folly absl::flat_hash_map absl::hash) - add_executable(memory-hashset-os hashset_memory.cpp) - target_compile_definitions(memory-hashset-os PRIVATE USE_MEMPROF=0) - target_link_libraries(memory-hashset-os PRIVATE tdutils Folly::folly absl::flat_hash_map absl::hash) + add_executable(memory-hashset-os hashset_memory.cpp) + target_compile_definitions(memory-hashset-os PRIVATE USE_MEMPROF=0) + target_link_libraries(memory-hashset-os PRIVATE tdutils Folly::folly absl::flat_hash_map absl::hash) - add_executable(hashmap-build hashmap_build.cpp) - target_link_libraries(hashmap-build PRIVATE tdutils Folly::folly absl::flat_hash_map absl::hash) + add_executable(hashmap-build hashmap_build.cpp) + target_link_libraries(hashmap-build PRIVATE tdutils Folly::folly absl::flat_hash_map absl::hash) + endif() endif() diff --git a/tdutils/CMakeLists.txt b/tdutils/CMakeLists.txt index b7c692bcc..36c0cdbb2 100644 --- a/tdutils/CMakeLists.txt +++ b/tdutils/CMakeLists.txt @@ -390,11 +390,13 @@ install(TARGETS tdutils EXPORT TdTargets ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) -find_package(benchmark QUIET) -find_package(folly QUIET) -find_package(gflags QUIET) +if (TD_TEST_FOLLY) + find_package(benchmark QUIET) + find_package(folly QUIET) + find_package(gflags QUIET) -if (ABSL_FOUND AND benchmark_FOUND AND folly_FOUND) - add_executable(benchmark-hashset test/hashset_benchmark.cpp) - target_link_libraries(benchmark-hashset PRIVATE tdutils benchmark::benchmark Folly::folly absl::flat_hash_map absl::hash) + if (ABSL_FOUND AND benchmark_FOUND AND folly_FOUND) + add_executable(benchmark-hashset test/hashset_benchmark.cpp) + target_link_libraries(benchmark-hashset PRIVATE tdutils benchmark::benchmark Folly::folly absl::flat_hash_map absl::hash) + endif() endif()