I want to link librdkafka with my project using CMakeList.txt
CMakeList.txt contains
cmake_minimum_required(VERSION 3.10)
project(client2 VERSION 1.0.0)
set(EXPORT_TARGETS_NAME ${PROJECT_NAME}Targets)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread -Wl,--no-undefined")
file(GLOB_RECURSE SOURCES src/*.cpp)
find_package(librdkafka)
add_executable(${PROJECT_NAME} ${SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
target_link_libraries(${PROJECT_NAME} librdkafka)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION tests/${PROJECT_NAME} COMPONENT tests
But i get next error:
[build] Could not find a package configuration file provided by "librdkafka" with any of the following names:
[build]
[build] librdkafkaConfig.cmake
[build] librdkafka-config.cmake
[build]
[build] Add the installation prefix of "librdkafka" to CMAKE_PREFIX_PATH or set
[build] "librdkafka_DIR" to a directory containing one of the above files. If
[build] "librdkafka" provides a separate development package or SDK, be sure it has
[build] been installed.
And I also get "can't find -llibrdkafka"
Please tell me the right way to do what I want