Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

librdkafka: add components #2803

Merged
merged 1 commit into from
Sep 8, 2020
Merged
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
1 change: 0 additions & 1 deletion recipes/librdkafka/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ patches:
base_path: source_subfolder
- patch_file: patches/0003-Fix-broken-version-1-4-0-on-windows.patch
base_path: source_subfolder

20 changes: 16 additions & 4 deletions recipes/librdkafka/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,22 @@ def package(self):
tools.rmdir(os.path.join(self.package_folder, "share"))

def package_info(self):
self.cpp_info.libs = ["rdkafka", "rdkafka++"]
self.cpp_info.names["cmake_find_package"] = "RdKafka"
self.cpp_info.names["cmake_find_package_multi"] = "RdKafka"
# rdkafka
self.cpp_info.components["rdkafka"].names["cmake_find_package"] = "rdkafka"
self.cpp_info.components["rdkafka"].names["cmake_find_package_multi"] = "rdkafka"
self.cpp_info.components["rdkafka"].names["pkg_config"] = "rdkafka"
self.cpp_info.components["rdkafka"].libs = ["rdkafka"]
if self.settings.compiler == "Visual Studio":
self.cpp_info.system_libs.extend(["crypt32", "ws2_32"])
self.cpp_info.components["rdkafka"].system_libs.extend(["crypt32", "ws2_32"])
elif self.settings.os == "Linux":
self.cpp_info.system_libs.extend(["pthread", "rt", "dl", "m"])
self.cpp_info.components["rdkafka"].system_libs.extend(["pthread", "rt", "dl", "m"])
if not self.options.shared:
self.cpp_info.defines.append("LIBRDKAFKA_STATICLIB")
self.cpp_info.components["rdkafka"].defines.append("LIBRDKAFKA_STATICLIB")
# rdkafka++
self.cpp_info.components["rdkafka++"].names["cmake_find_package"] = "rdkafka++"
self.cpp_info.components["rdkafka++"].names["cmake_find_package_multi"] = "rdkafka++"
self.cpp_info.components["rdkafka++"].names["pkg_config"] = "rdkafka++"
self.cpp_info.components["rdkafka++"].libs = ["rdkafka++"]
self.cpp_info.components["rdkafka++"].requires = ["rdkafka"]
6 changes: 4 additions & 2 deletions recipes/librdkafka/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.1)
project(PackageTest CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

find_package(RdKafka REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
target_link_libraries(${PROJECT_NAME} RdKafka::rdkafka)
2 changes: 1 addition & 1 deletion recipes/librdkafka/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class LibrdkafkaTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
generators = "cmake", "cmake_find_package_multi"

def build(self):
cmake = CMake(self)
Expand Down