From c0b2c9a3cf09144918343f00fb219471557e7394 Mon Sep 17 00:00:00 2001 From: battlmonstr Date: Tue, 12 Mar 2024 14:55:11 +0100 Subject: [PATCH] sync: use silkworm_library --- cmd/test/CMakeLists.txt | 7 ------- silkworm/sync/CMakeLists.txt | 14 ++++++-------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/cmd/test/CMakeLists.txt b/cmd/test/CMakeLists.txt index 930a5ba695..9faa0d6648 100644 --- a/cmd/test/CMakeLists.txt +++ b/cmd/test/CMakeLists.txt @@ -30,8 +30,6 @@ else() endif() if(NOT SILKWORM_CORE_ONLY) - find_package(GTest REQUIRED) - # Enable fuzzing tests for Clang sanitizer builds only if("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang$" AND SILKWORM_FUZZER) # macOS on 64-bit ARM does not support option -fsanitize=leak @@ -65,11 +63,6 @@ if(NOT SILKWORM_CORE_ONLY) ) endif() - # Silkworm Sync Tests - file(GLOB_RECURSE SILKWORM_SYNC_TESTS CONFIGURE_DEPENDS "${SILKWORM_MAIN_SRC_DIR}/sync/*_test.cpp") - add_executable(sync_test unit_test.cpp ${SILKWORM_SYNC_TESTS}) - target_link_libraries(sync_test silkworm_node silkworm_sync Catch2::Catch2 GTest::gmock) - # Ethereum EL Tests (https://github.com/ethereum/tests) find_package(CLI11 REQUIRED) add_executable(ethereum ethereum.cpp) diff --git a/silkworm/sync/CMakeLists.txt b/silkworm/sync/CMakeLists.txt index d99bb45960..dd2673a65d 100644 --- a/silkworm/sync/CMakeLists.txt +++ b/silkworm/sync/CMakeLists.txt @@ -14,14 +14,12 @@ limitations under the License. ]] +include("${SILKWORM_MAIN_DIR}/cmake/common/targets.cmake") + find_package(absl REQUIRED) +find_package(GTest REQUIRED) find_package(magic_enum REQUIRED) -file(GLOB_RECURSE SILKWORM_SYNC_SRC CONFIGURE_DEPENDS "*.cpp" "*.hpp") -list(FILTER SILKWORM_SYNC_SRC EXCLUDE REGEX "_test\\.cpp$") - -add_library(silkworm_sync "${SILKWORM_SYNC_SRC}") - set(SILKWORM_SYNC_PUBLIC_LIBS silkworm_rpcdaemon silkworm_node @@ -32,8 +30,6 @@ set(SILKWORM_SYNC_PUBLIC_LIBS absl::btree ) -target_include_directories(silkworm_sync PUBLIC "${SILKWORM_MAIN_DIR}") - # cmake-format: off set(SILKWORM_SYNC_PRIVATE_LIBS cborcpp @@ -42,8 +38,10 @@ set(SILKWORM_SYNC_PRIVATE_LIBS ) # cmake-format: on -target_link_libraries( +silkworm_library( silkworm_sync PUBLIC ${SILKWORM_SYNC_PUBLIC_LIBS} PRIVATE ${SILKWORM_SYNC_PRIVATE_LIBS} ) + +target_link_libraries(silkworm_sync_test PRIVATE GTest::gmock silkworm_db_test_util)