mfontanini / cppkafka

Modern C++ Apache Kafka client library (wrapper for librdkafka)
BSD 2-Clause "Simplified" License
587 stars 207 forks source link

add_library(Rdkafka::rdkafka) issue #308

Open mohammad-nazari opened 1 year ago

mohammad-nazari commented 1 year ago

Hi,

Ubuntu version: 22.04 CppKafka version: 0.4.0 CMake version: 3.25.2

Imagine we have a project with two sub-projects 'foo' and 'bar'. Both of them use the CppKafka. They have the command 'find_package(CppKafka REQUIRED)' in their CMakeLists.txt file. Cmake gets this error: CMake Error at /usr/local/lib/cmake/CppKafka/FindRdKafka.cmake:57 (add_library): add_library cannot create imported target "RdKafka::rdkafka" because another target with the same name already exists. It occurs if we have more than one calling 'find_package(CppKafka REQUIRED)' command.