vcpkg/ports/librdkafka/portfile.cmake
Chen Yufei f4e370b968
[librdkafka] fix find_dependency LZ4. (#23815)
* [librdkafka] fix find_dependency LZ4.

Include `FindLZ4.cmake` will result following error message:

```
CMake Warning (dev) at /usr/local/lib/python3.6/dist-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (LZ4) does
  not match the name of the calling package (RdKafka).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
```

* [librdkafka] update port-version.

* Prepend and restore cmake module path.

* Update version database

* Update ports/librdkafka/portfile.cmake

* use the lz4 config files

Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com>
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
2022-04-05 15:50:35 -07:00

73 lines
2.0 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO edenhill/librdkafka
REF v1.8.2
SHA512 8c8ae291129b78e3b8367307ad1b1715af1438cd76d7160d64d13a58adf84c7c9f51efeba4656f55e101c25e4cb744db0d8bb5c01a2decb229e4567d16bdcb22
HEAD_REF master
PATCHES lz4.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" RDKAFKA_BUILD_STATIC)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
ssl WITH_SSL
zlib WITH_ZLIB
zstd WITH_ZSTD
snappy WITH_SNAPPY
)
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DRDKAFKA_BUILD_STATIC=${RDKAFKA_BUILD_STATIC}
-DRDKAFKA_BUILD_EXAMPLES=OFF
-DRDKAFKA_BUILD_TESTS=OFF
-DWITH_BUNDLED_SSL=OFF
${FEATURE_OPTIONS}
OPTIONS_DEBUG
-DENABLE_SHAREDPTR_DEBUG=ON
-DENABLE_DEVEL=ON
-DENABLE_REFCNT_DEBUG=OFF
-DENABLE_SHAREDPTR_DEBUG=ON
-DWITHOUT_OPTIMIZATION=ON
OPTIONS_RELEASE
-DENABLE_SHAREDPTR_DEBUG=OFF
-DENABLE_DEVEL=OFF
-DENABLE_REFCNT_DEBUG=OFF
-DENABLE_SHAREDPTR_DEBUG=OFF
-DWITHOUT_OPTIMIZATION=OFF
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(
PACKAGE_NAME RdKafka
CONFIG_PATH lib/cmake/RdKafka
)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
foreach(hdr rdkafka.h rdkafkacpp.h)
vcpkg_replace_string(
"${CURRENT_PACKAGES_DIR}/include/librdkafka/${hdr}"
"#ifdef LIBRDKAFKA_STATICLIB"
"#if 1 // #ifdef LIBRDKAFKA_STATICLIB"
)
endforeach()
endif()
# Handle copyright
configure_file("${SOURCE_PATH}/LICENSES.txt" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
# Install usage
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY)
vcpkg_fixup_pkgconfig()