Files
zeekay 3094cd1739 build: point the last 13 contrib cmake files at Datastore_SOURCE_DIR
Configure now COMPLETES ("Configuring done (19.3s)") and the build died in the
generate step instead, on "No SOURCES given to target" for _zxc, _zxc_*_avx2/512,
_simdutf and libdeflate.

The targets are not empty; the paths were. CMake defines <PROJECT>_SOURCE_DIR,
and CMakeLists.txt:18 declares project(Datastore), so ClickHouse_SOURCE_DIR is
simply an undefined variable that expands to the empty string. Every contrib
wrapper still spelling it that way built its source path as "/contrib/zxc" or
"/contrib/simdutf/src" — rooted at /, not at the source tree — so the globs
matched nothing and add_library was handed an empty list. An undefined variable
is not an error in CMake, which is why this surfaced as a missing-sources
complaint about the target rather than a bad path.

This is the same unfinished rename as the previous commit wearing different
clothes. Swept both spellings across every in-repo cmake file: exactly two tokens,
ClickHouse_SOURCE_DIR and ClickHouse_BINARY_DIR, 23 occurrences in 13 files, all
of them contrib/*-cmake wrappers plus src/CMakeLists.txt. The submodules
themselves are untouched — the wrappers are ours, contrib/<name>-cmake is not a
.gitmodules path.

Renamed rather than aliased. A one-line set(ClickHouse_SOURCE_DIR
${Datastore_SOURCE_DIR}) in the root would also have worked and would cost less
on the next upstream merge, but the tree already carries hundreds of
Datastore_SOURCE_DIR uses in these same directories: the choice to rename was
made when the project was renamed, and these 13 files are the remainder of that
job, not a new decision. Two spellings for one path is the thing that produced
this bug in the first place.
2026-08-06 14:18:48 -07:00

31 lines
1.2 KiB
CMake

option (ENABLE_LIBDEFLATE "Enable libdeflate (fast one-shot DEFLATE/zlib/gzip codec)" ${ENABLE_LIBRARIES})
if (NOT ENABLE_LIBDEFLATE)
message(STATUS "Not using libdeflate")
return()
endif()
set(LIBDEFLATE_SOURCE_DIR "${Datastore_SOURCE_DIR}/contrib/libdeflate")
# Architecture-specific code is pulled in via headers from these translation units, so the same
# source list builds on every target; the per-arch cpu_features.c files compile to nothing on a
# foreign architecture.
set(SRCS
"${LIBDEFLATE_SOURCE_DIR}/lib/utils.c"
"${LIBDEFLATE_SOURCE_DIR}/lib/arm/cpu_features.c"
"${LIBDEFLATE_SOURCE_DIR}/lib/x86/cpu_features.c"
"${LIBDEFLATE_SOURCE_DIR}/lib/deflate_compress.c"
"${LIBDEFLATE_SOURCE_DIR}/lib/deflate_decompress.c"
"${LIBDEFLATE_SOURCE_DIR}/lib/adler32.c"
"${LIBDEFLATE_SOURCE_DIR}/lib/zlib_compress.c"
"${LIBDEFLATE_SOURCE_DIR}/lib/zlib_decompress.c"
"${LIBDEFLATE_SOURCE_DIR}/lib/crc32.c"
"${LIBDEFLATE_SOURCE_DIR}/lib/gzip_compress.c"
"${LIBDEFLATE_SOURCE_DIR}/lib/gzip_decompress.c"
)
add_library(_libdeflate ${SRCS})
add_library(ch_contrib::libdeflate ALIAS _libdeflate)
target_include_directories(_libdeflate SYSTEM BEFORE PUBLIC "${LIBDEFLATE_SOURCE_DIR}")