From 48b5c098dd24de26275ce27d819665db62e4bd26 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 17 Jan 2022 22:16:12 +0300 Subject: [PATCH] Remove unbundled farmhash support --- CMakeLists.txt | 2 -- cmake/Modules/Findfarmhash.cmake | 44 ------------------------ contrib/CMakeLists.txt | 5 +-- contrib/libfarmhash/CMakeLists.txt | 12 ++++--- src/Functions/CMakeLists.txt | 2 +- src/Interpreters/examples/CMakeLists.txt | 4 +-- 6 files changed, 11 insertions(+), 58 deletions(-) delete mode 100644 cmake/Modules/Findfarmhash.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dcaba0ffe9..11d3e82b563 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -523,8 +523,6 @@ include (cmake/find/cassandra.cmake) include (cmake/find/sentry.cmake) include (cmake/find/datasketches.cmake) -find_contrib_lib(farmhash) - if (ENABLE_TESTS) include (cmake/find/gtest.cmake) endif () diff --git a/cmake/Modules/Findfarmhash.cmake b/cmake/Modules/Findfarmhash.cmake deleted file mode 100644 index 2b45fde2c67..00000000000 --- a/cmake/Modules/Findfarmhash.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# - Try to find farmhash headers and libraries. -# -# Usage of this module as follows: -# -# find_package(farmhash) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# FARMHASH_ROOT_DIR Set this variable to the root installation of -# farmhash if the module has problems finding -# the proper installation path. -# -# Variables defined by this module: -# -# FARMHASH_FOUND System has farmhash libs/headers -# FARMHASH_LIBRARIES The farmhash library/libraries -# FARMHASH_INCLUDE_DIR The location of farmhash headers - -find_path(FARMHASH_ROOT_DIR - NAMES include/farmhash.h -) - -find_library(FARMHASH_LIBRARIES - NAMES farmhash - PATHS ${FARMHASH_ROOT_DIR}/lib ${FARMHASH_LIBRARIES_PATHS} -) - -find_path(FARMHASH_INCLUDE_DIR - NAMES farmhash.h - PATHS ${FARMHASH_ROOT_DIR}/include ${FARMHASH_INCLUDE_PATHS} -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(farmhash DEFAULT_MSG - FARMHASH_LIBRARIES - FARMHASH_INCLUDE_DIR -) - -mark_as_advanced( - FARMHASH_ROOT_DIR - FARMHASH_LIBRARIES - FARMHASH_INCLUDE_DIR -) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index a00b1ed7cbd..d8fb16f30ee 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -78,10 +78,7 @@ endif() # TODO: refactor the contrib libraries below this comment. add_subdirectory (cityhash102) - -if (USE_INTERNAL_FARMHASH_LIBRARY) - add_subdirectory (libfarmhash) -endif () +add_subdirectory (libfarmhash) if (USE_INTERNAL_H3_LIBRARY) add_subdirectory(h3-cmake) diff --git a/contrib/libfarmhash/CMakeLists.txt b/contrib/libfarmhash/CMakeLists.txt index 20bba58cde7..a0533a93f17 100644 --- a/contrib/libfarmhash/CMakeLists.txt +++ b/contrib/libfarmhash/CMakeLists.txt @@ -1,9 +1,11 @@ -add_library(farmhash - farmhash.cc - farmhash.h) +add_library(_farmhash + farmhash.cc + farmhash.h) if (MSVC) - target_compile_definitions (farmhash PRIVATE FARMHASH_NO_BUILTIN_EXPECT=1) + target_compile_definitions (_farmhash PRIVATE FARMHASH_NO_BUILTIN_EXPECT=1) endif () -target_include_directories (farmhash PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories (_farmhash BEFORE PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +add_library(ch_contrib::farmhash ALIAS _farmhash) diff --git a/src/Functions/CMakeLists.txt b/src/Functions/CMakeLists.txt index f9f2e37cedb..73e153666af 100644 --- a/src/Functions/CMakeLists.txt +++ b/src/Functions/CMakeLists.txt @@ -14,7 +14,7 @@ target_link_libraries(clickhouse_functions PUBLIC ${BASE64_LIBRARY} ch_contrib::cityhash - ${FARMHASH_LIBRARIES} + ch_contrib::farmhash ${FASTOPS_LIBRARY} clickhouse_dictionaries clickhouse_dictionaries_embedded diff --git a/src/Interpreters/examples/CMakeLists.txt b/src/Interpreters/examples/CMakeLists.txt index 742a114f7c4..262161c62a8 100644 --- a/src/Interpreters/examples/CMakeLists.txt +++ b/src/Interpreters/examples/CMakeLists.txt @@ -5,7 +5,7 @@ add_executable (hash_map_lookup hash_map_lookup.cpp) target_link_libraries (hash_map_lookup PRIVATE dbms) add_executable (hash_map3 hash_map3.cpp) -target_link_libraries (hash_map3 PRIVATE dbms ${FARMHASH_LIBRARIES} metrohash) +target_link_libraries (hash_map3 PRIVATE dbms ch_contrib::farmhash metrohash) add_executable (hash_map_string hash_map_string.cpp) target_link_libraries (hash_map_string PRIVATE dbms) @@ -14,7 +14,7 @@ add_executable (hash_map_string_2 hash_map_string_2.cpp) target_link_libraries (hash_map_string_2 PRIVATE dbms) add_executable (hash_map_string_3 hash_map_string_3.cpp) -target_link_libraries (hash_map_string_3 PRIVATE dbms ${FARMHASH_LIBRARIES} metrohash) +target_link_libraries (hash_map_string_3 PRIVATE dbms ch_contrib::farmhash metrohash) add_executable (hash_map_string_small hash_map_string_small.cpp) target_link_libraries (hash_map_string_small PRIVATE dbms)