Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support for CMake #411

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion clickhouse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ TARGET_LINK_LIBRARIES (clickhouse-cpp-lib
zstd::zstd
)
TARGET_INCLUDE_DIRECTORIES (clickhouse-cpp-lib
PUBLIC ${PROJECT_SOURCE_DIR}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/clickhouse>
)

IF (NOT BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -153,10 +155,29 @@ ENDIF ()


INSTALL (TARGETS clickhouse-cpp-lib
EXPORT clickhouse-cpp-config
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)

include(CMakePackageConfigHelpers)
configure_package_config_file(
../cmake/clickhouse-cpp-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/clickhouse-cpp-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/clickhouse-cpp
)

INSTALL(EXPORT clickhouse-cpp-config
FILE clickhouse-cpp-targets.cmake
DESTINATION lib/cmake/clickhouse-cpp
)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/clickhouse-cpp-config.cmake DESTINATION lib/cmake/clickhouse-cpp)

install(FILES ../cmake/Findcityhash.cmake DESTINATION lib/cmake/clickhouse-cpp)
install(FILES ../cmake/Findlz4.cmake DESTINATION lib/cmake/clickhouse-cpp)
install(FILES ../cmake/Findzstd.cmake DESTINATION lib/cmake/clickhouse-cpp)

# general
INSTALL(FILES block.h DESTINATION include/clickhouse/)
INSTALL(FILES client.h DESTINATION include/clickhouse/)
Expand Down
10 changes: 10 additions & 0 deletions cmake/clickhouse-cpp-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
find_dependency(absl)
find_dependency(cityhash)
find_dependency(lz4)
find_dependency(zstd)

include(clickhouse-cpp-targets)
Loading