diff --git a/CMakeLists.txt b/CMakeLists.txt index d122573e4bfd..6bb6c83971d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -276,10 +276,6 @@ if(VELOX_ENABLE_PARQUET) set(VELOX_ENABLE_ARROW ON) endif() -if(VELOX_ENABLE_COMPRESSION_LZ4) - add_definitions(-DVELOX_ENABLE_COMPRESSION_LZ4) -endif() - # make buildPartitionBounds_ a vector int64 instead of int32 to avoid integer # overflow if(${VELOX_ENABLE_INT64_BUILD_PARTITION_BOUND}) diff --git a/velox/common/compression/CMakeLists.txt b/velox/common/compression/CMakeLists.txt index c94c86a61714..5e88fba0ee5a 100644 --- a/velox/common/compression/CMakeLists.txt +++ b/velox/common/compression/CMakeLists.txt @@ -16,17 +16,21 @@ if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) endif() -set(VELOX_COMMON_COMPRESSION_SRCS Compression.cpp LzoDecompressor.cpp) -set(VELOX_COMMON_COMPRESSION_LINK_LIBS velox_status Folly::folly) - -if(VELOX_ENABLE_COMPRESSION_LZ4) - list(APPEND VELOX_COMMON_COMPRESSION_SRCS Lz4Compression.cpp - HadoopCompressionFormat.cpp) - list(APPEND VELOX_COMMON_COMPRESSION_LINK_LIBS lz4::lz4) -endif() - -velox_add_library(velox_common_compression ${VELOX_COMMON_COMPRESSION_SRCS}) +velox_add_library( + velox_common_compression + Compression.cpp + LzoDecompressor.cpp + Lz4Compression.cpp + HadoopCompressionFormat.cpp) velox_link_libraries( velox_common_compression - PUBLIC ${VELOX_COMMON_COMPRESSION_LINK_LIBS} + PUBLIC velox_status Folly::folly lz4::lz4 PRIVATE velox_exception) + +if(VELOX_ENABLE_COMPRESSION_LZ4) + velox_sources(velox_common_compression PRIVATE Lz4Compression.cpp + HadoopCompressionFormat.cpp) + velox_link_libraries(velox_common_compression PUBLIC lz4::lz4) + velox_compile_definitions(velox_common_compression + PRIVATE VELOX_ENABLE_COMPRESSION_LZ4) +endif()