From 43ca3853c6f31417b5618711092f55f49d3dfec0 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 26 Aug 2020 23:28:33 +0200 Subject: [PATCH] librdkafka: add components --- recipes/librdkafka/all/conandata.yml | 1 - recipes/librdkafka/all/conanfile.py | 20 +++++++++++++++---- .../all/test_package/CMakeLists.txt | 6 ++++-- .../librdkafka/all/test_package/conanfile.py | 2 +- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/recipes/librdkafka/all/conandata.yml b/recipes/librdkafka/all/conandata.yml index b4d3932e4b33d..2ed6463370ba3 100644 --- a/recipes/librdkafka/all/conandata.yml +++ b/recipes/librdkafka/all/conandata.yml @@ -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 - diff --git a/recipes/librdkafka/all/conanfile.py b/recipes/librdkafka/all/conanfile.py index d89822579e8a3..b6382003d9450 100644 --- a/recipes/librdkafka/all/conanfile.py +++ b/recipes/librdkafka/all/conanfile.py @@ -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"] diff --git a/recipes/librdkafka/all/test_package/CMakeLists.txt b/recipes/librdkafka/all/test_package/CMakeLists.txt index 54a7825fef59d..2a0ef606af807 100644 --- a/recipes/librdkafka/all/test_package/CMakeLists.txt +++ b/recipes/librdkafka/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/librdkafka/all/test_package/conanfile.py b/recipes/librdkafka/all/test_package/conanfile.py index 0b26ec326d358..908f1227b2b55 100644 --- a/recipes/librdkafka/all/test_package/conanfile.py +++ b/recipes/librdkafka/all/test_package/conanfile.py @@ -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)