Skip to content

Commit

Permalink
Try unify names
Browse files Browse the repository at this point in the history
  • Loading branch information
fdr400 committed Jan 27, 2025
1 parent 47e6bc2 commit 6e5a6d2
Show file tree
Hide file tree
Showing 39 changed files with 167 additions and 164 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ option(USERVER_FEATURE_OTLP "Provide asynchronous OTLP exporters" "${USERVER_LIB
set(CMAKE_DEBUG_POSTFIX d)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(USERVER_CONAN AND NOT DEFINED CMAKE_FIND_PACKAGE_PREFER_CONFIG)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
endif()

set(USERVER_USE_STATIC_LIBS_DEFAULT OFF)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0)
Expand Down
6 changes: 2 additions & 4 deletions clickhouse/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
project(userver-clickhouse CXX)

if (USERVER_CONAN)
find_package(clickhouse-cpp REQUIRED CONFIG)
set(CLICKHOUSE_CPP_TARGET clickhouse-cpp-lib::clickhouse-cpp-lib)
find_package(clickhouse-cpp REQUIRED)
else()
include(SetupClickhouseCPP)
set(CLICKHOUSE_CPP_TARGET clickhouse-cpp)
endif()

userver_module(clickhouse
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
LINK_LIBRARIES_PRIVATE "${CLICKHOUSE_CPP_TARGET}"
LINK_LIBRARIES_PRIVATE clickhouse-cpp-lib::clickhouse-cpp-lib

UTEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*_test.cpp"
DBTEST_SOURCES
Expand Down
6 changes: 3 additions & 3 deletions cmake/SetupCryptoPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ option(

if (NOT USERVER_FORCE_DOWNLOAD_PACKAGES)
if (USERVER_DOWNLOAD_PACKAGE_CRYPTOPP)
find_package(CryptoPP QUIET)
find_package(cryptopp QUIET)
else()
find_package(CryptoPP REQUIRED)
find_package(cryptopp REQUIRED)
endif()

if (CryptoPP_FOUND)
if (cryptopp_FOUND)
return()
endif()
endif()
Expand Down
2 changes: 0 additions & 2 deletions cmake/SetupMongoDeps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ if (USERVER_MONGODB_USE_CMAKE_CONFIG)
find_package(mongoc-1.0 QUIET CONFIG)
if(mongoc-1.0_FOUND)
message(STATUS "Mongoc: using config version: (bson: ${bson-1.0_VERSION}, mongoc: ${mongoc-1.0_VERSION})")
add_library(bson ALIAS mongo::bson_static)
add_library(mongoc ALIAS mongo::mongoc_static)
return()
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/SetupProtobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function(_userver_set_protobuf_version_category)
endfunction()

if(USERVER_CONAN)
find_package(Protobuf REQUIRED CONFIG)
find_package(Protobuf REQUIRED)
_userver_set_protobuf_version_category()
set(PROTOBUF_PROTOC "${Protobuf_PROTOC_EXECUTABLE}")
return()
Expand Down
2 changes: 1 addition & 1 deletion cmake/SetupRdKafka.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/SetupCURL.cmake")

find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(libzstd REQUIRED)
find_package(zstd REQUIRED)
find_package(lz4 REQUIRED)
find_package(SASL2 REQUIRED)

Expand Down
2 changes: 1 addition & 1 deletion cmake/SetupRocksDB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ find_package(libgflags REQUIRED)
find_package(libsnappy REQUIRED)
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
find_package(libzstd REQUIRED)
find_package(zstd REQUIRED)

include(DownloadUsingCPM)

Expand Down
14 changes: 10 additions & 4 deletions cmake/install/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ set(USERVER_IMPL_ORIGINAL_CXX_STANDARD @CMAKE_CXX_STANDARD@)
set(USERVER_IMPL_FEATURE_JEMALLOC @USERVER_FEATURE_JEMALLOC@)
set(USERVER_USE_STATIC_LIBS @USERVER_USE_STATIC_LIBS@)

if(USERVER_CONAN AND NOT DEFINED CMAKE_FIND_PACKAGE_PREFER_CONFIG)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
endif()

set_property(GLOBAL PROPERTY userver_cmake_dir "${USERVER_CMAKE_DIR}")
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
list(PREPEND CMAKE_MODULE_PATH "${USERVER_CMAKE_DIR}/modules")
else()
list(APPEND CMAKE_MODULE_PATH "${USERVER_CMAKE_DIR}/modules")
if(NOT USERVER_CONAN)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
list(PREPEND CMAKE_MODULE_PATH "${USERVER_CMAKE_DIR}/modules")
else()
list(APPEND CMAKE_MODULE_PATH "${USERVER_CMAKE_DIR}/modules")
endif()
endif()

include("${USERVER_CMAKE_DIR}/UserverPreferStaticLibs.cmake")
Expand Down
6 changes: 1 addition & 5 deletions cmake/install/userver-clickhouse-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ find_package(userver REQUIRED COMPONENTS
core
)

if (USERVER_CONAN)
find_package(clickhouse-cpp REQUIRED CONFIG)
else()
find_package(clickhouse-cpp REQUIRED)
endif()
find_package(clickhouse-cpp REQUIRED)

set(userver_clickhouse_FOUND TRUE)
17 changes: 7 additions & 10 deletions cmake/install/userver-core-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ find_package(Boost REQUIRED CONFIG COMPONENTS
)

find_package(ZLIB REQUIRED)

include("${USERVER_CMAKE_DIR}/UserverTestsuite.cmake")
find_package(c-ares REQUIRED)
find_package(libnghttp2 REQUIRED)
find_package(libev REQUIRED)

if (USERVER_CONAN)
find_package(c-ares REQUIRED CONFIG)
find_package(libnghttp2 REQUIRED CONFIG)
find_package(libev REQUIRED CONFIG)
find_package(concurrentqueue REQUIRED CONFIG)
find_package(CURL "7.68" REQUIRED CONFIG)
find_package(concurrentqueue REQUIRED)
find_package(CURL "7.68" REQUIRED)
else()
find_package(Nghttp2 REQUIRED)
find_package(LibEv REQUIRED)
find_package(c-ares REQUIRED)
include("${USERVER_CMAKE_DIR}/SetupCURL.cmake")
endif()

include("${USERVER_CMAKE_DIR}/UserverTestsuite.cmake")

set(userver_core_FOUND TRUE)
2 changes: 1 addition & 1 deletion cmake/install/userver-kafka-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ find_package(userver REQUIRED COMPONENTS
)

if(USERVER_CONAN)
find_package(RdKafka REQUIRED CONFIG)
find_package(RdKafka REQUIRED)
else()
include("${USERVER_CMAKE_DIR}/SetupRdKafka.cmake")
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/install/userver-mongo-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ find_package(userver REQUIRED COMPONENTS
)

if (USERVER_CONAN)
find_package(mongoc-1.0 REQUIRED CONFIG)
find_package(mongoc-1.0 REQUIRED)
else()
include("${USERVER_CMAKE_DIR}/SetupMongoDeps.cmake")
endif()
Expand Down
6 changes: 1 addition & 5 deletions cmake/install/userver-mysql-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ find_package(userver REQUIRED COMPONENTS
core
)

if (USERVER_CONAN)
find_package(libmariadb REQUIRED CONFIG)
else()
find_package(libmariadb REQUIRED)
endif()
find_package(libmariadb REQUIRED)

set(userver_mysql_FOUND TRUE)
6 changes: 1 addition & 5 deletions cmake/install/userver-rabbitmq-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ find_package(userver REQUIRED COMPONENTS
core
)

if(USERVER_CONAN)
find_package(amqpcpp REQUIRED CONFIG)
else()
find_package(amqpcpp REQUIRED)
endif()
find_package(amqpcpp REQUIRED)

set(userver_rabbitmq_FOUND TRUE)
6 changes: 1 addition & 5 deletions cmake/install/userver-redis-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ find_package(userver REQUIRED COMPONENTS
core
)

if (USERVER_CONAN)
find_package(hiredis REQUIRED CONFIG)
else()
find_package(Hiredis REQUIRED)
endif()
find_package(hiredis REQUIRED)

set(userver_redis_FOUND TRUE)
2 changes: 1 addition & 1 deletion cmake/install/userver-rocks-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ find_package(userver REQUIRED COMPONENTS
core
)

find_package(RocksDB REQUIRED CONFIG)
find_package(RocksDB REQUIRED)

set(userver_rocks_FOUND TRUE)
6 changes: 1 addition & 5 deletions cmake/install/userver-s3api-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ find_package(userver REQUIRED COMPONENTS
core
)

if(USERVER_CONAN)
find_package(pugixml REQUIRED CONFIG)
else()
find_package(Pugixml REQUIRED)
endif()
find_package(pugixml REQUIRED)

set(userver_s3api_FOUND TRUE)

38 changes: 16 additions & 22 deletions cmake/install/userver-universal-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,18 @@ if (USERVER_IMPL_FEATURE_JEMALLOC AND
NOT USERVER_SANITIZE AND
NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")

if (USERVER_CONAN)
find_package(jemalloc REQUIRED CONFIG)
else()
include("${USERVER_CMAKE_DIR}/modules/FindJemalloc.cmake")
endif()
find_package(jemalloc REQUIRED)
endif()

if (USERVER_CONAN)
find_package(fmt REQUIRED CONFIG)
find_package(cctz REQUIRED CONFIG)
find_package(cryptopp REQUIRED CONFIG)
find_package(yaml-cpp REQUIRED CONFIG)
find_package(zstd REQUIRED CONFIG)
find_package(re2 REQUIRED CONFIG)
find_package(fmt REQUIRED)
find_package(cctz REQUIRED)
find_package(re2 REQUIRED)
find_package(cryptopp REQUIRED)
find_package(zstd REQUIRED)
find_package(yaml-cpp REQUIRED)

find_package(RapidJSON REQUIRED CONFIG)
else()
find_package(fmt REQUIRED)
find_package(cctz REQUIRED)
find_package(CryptoPP REQUIRED)
find_package(libyamlcpp REQUIRED)
find_package(libzstd REQUIRED)
find_package(re2 REQUIRED)
if (USERVER_CONAN)
find_package(RapidJSON REQUIRED)
endif()

include("${USERVER_CMAKE_DIR}/AddGoogleTests.cmake")
Expand All @@ -63,8 +52,13 @@ include("${USERVER_CMAKE_DIR}/UserverEmbedFile.cmake")
userver_setup_environment()
_userver_make_sanitize_blacklist()

include("${USERVER_CMAKE_DIR}/SetupGTest.cmake")
include("${USERVER_CMAKE_DIR}/SetupGBench.cmake")
if(USERVER_CONAN)
find_package(GTest REQUIRED)
find_package(benchmark REQUIRED)
else()
include("${USERVER_CMAKE_DIR}/SetupGTest.cmake")
include("${USERVER_CMAKE_DIR}/SetupGBench.cmake")
endif()

if(NOT USERVER_IMPL_ORIGINAL_CXX_STANDARD STREQUAL CMAKE_CXX_STANDARD)
target_compile_definitions(userver::universal INTERFACE
Expand Down
17 changes: 17 additions & 0 deletions cmake/modules/Findamqpcpp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
_userver_module_begin(
NAME amqpcpp
VERSION 4.3.18
FORMULA_NAMES amqp-cpp
PACMAN_NAMES amqp-cpp
PKG_CONFIG_NAMES amqpcpp
)

_userver_module_find_include(
NAMES amqpcpp.h
)

_userver_module_find_library(
NAMES amqpcpp
)

_userver_module_end()
4 changes: 4 additions & 0 deletions cmake/modules/Findbson.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ _userver_module_find_library(
)

_userver_module_end()

if(NOT TARGET mongo::bson_static)
add_library(mongo::bson_static ALIAS bson)
endif()
4 changes: 4 additions & 0 deletions cmake/modules/Findclickhouse-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
endif()

_userver_module_end()

if(NOT TARGET clickhouse-cpp-lib::clickhouse-cpp-lib)
add_library(clickhouse-cpp-lib::clickhouse-cpp-lib ALIAS clickhouse-cpp)
endif()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_userver_module_begin(
NAME CryptoPP
NAME cryptopp
DEBIAN_NAMES libcrypto++-dev
FORMULA_NAMES cryptopp
RPM_NAMES cryptopp-devel
Expand All @@ -18,3 +18,7 @@ _userver_module_find_library(
)

_userver_module_end()

if(NOT TARGET cryptopp::cryptopp)
add_library(cryptopp::cryptopp ALIAS cryptopp)
endif()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_userver_module_begin(
NAME Hiredis
NAME hiredis
VERSION 0.13.3
DEBIAN_NAMES libhiredis-dev
FORMULA_NAMES hiredis
Expand All @@ -18,3 +18,7 @@ _userver_module_find_library(
)

_userver_module_end()

if(NOT TARGET hiredis::hiredis)
add_library(hiredis::hiredis ALIAS hiredis)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(USERVER_SANITIZE)
endif()

_userver_module_begin(
NAME Jemalloc
NAME jemalloc
DEBIAN_NAMES libjemalloc-dev
FORMULA_NAMES jemalloc
RPM_NAMES jemalloc-devel
Expand All @@ -23,3 +23,7 @@ _userver_module_find_library(
)

_userver_module_end()

if(NOT TARGET jemalloc::jemalloc)
add_library(jemalloc::jemalloc ALIAS jemalloc)
endif()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_userver_module_begin(
NAME LibEv
NAME libev
DEBIAN_NAMES libev-dev
FORMULA_NAMES libev
RPM_NAMES libev-devel
Expand All @@ -15,3 +15,7 @@ _userver_module_find_library(
)

_userver_module_end()

if(NOT TARGET libev::libev)
add_library(libev::libev ALIAS libev)
endif()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_userver_module_begin(
NAME Nghttp2
NAME libnghttp2
DEBIAN_NAMES libnghttp2-dev
FORMULA_NAMES nghttp2
PACMAN_NAMES libnghttp2
Expand All @@ -14,3 +14,7 @@ _userver_module_find_library(
)

_userver_module_end()

if(NOT TARGET libnghttp2::nghttp2)
add_library(libnghttp2::nghttp2 ALIAS libnghttp2)
endif()
4 changes: 4 additions & 0 deletions cmake/modules/Findmongoc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ _userver_module_find_library(
)

_userver_module_end()

if(NOT TARGET mongo::mongoc_static)
add_library(mongo::mongoc_static ALIAS mongoc)
endif()
Loading

0 comments on commit 6e5a6d2

Please sign in to comment.