CMake 找不到 librdkafka
librdkafka not found by CMake
我正在尝试在使用 CMake 构建的项目中使用 Kafka。
我安装了 librdkafka-dev(版本 0.8.6-1.1)。
我也尝试从 Git 下载项目并手动构建它,这似乎是成功的。
我注意到 librdkafka/packaging/cmake 中有一个 README.md 文件,并按照其说明在目录中成功创建了 librdkafka 的 CMake 版本。
运行 我项目中的 'cmake' 命令导致以下错误:
CMake Error at CMakeLists.txt:8 (find_package):
By not providing "Findlibrdkafka.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"librdkafka", but CMake did not find one.
Could not find a package configuration file provided by "librdkafka" with
any of the following names:
librdkafkaConfig.cmake
librdkafka-config.cmake
Add the installation prefix of "librdkafka" to CMAKE_PREFIX_PATH or set
"librdkafka_DIR" to a directory containing one of the above files. If
"librdkafka" provides a separate development package or SDK, be sure it has
been installed.
有可能 librdkafka 只是在 CMakeLists.txt 文件中查找 rdkafka 的错误包名称,但我还没有找到如何在不使用 Cppkafka 包装器的情况下将它添加到 CMake。
所以我尝试下载并构建 Cppkafka(运行 其目录文件夹中的 cmake ..
),结果出现以下错误:
-- Build will generate a shared library. Use CPPKAFKA_BUILD_SHARED=0 to perform a static build
-- RdKafkaConfig.cmake not found. Attempting to find module instead...
-- Could NOT find RDKAFKA (missing: RdKafka_LIBRARY_DIR)
-- Found valid rdkafka version
-- RdKafka module found.
-- Disabling tests because submodule Catch2 isn't checked out
-- Configuring done
CMake Error in src/CMakeLists.txt:
Target "RdKafka::rdkafka" contains relative path in its
INTERFACE_LINK_DIRECTORIES:
"RdKafka_LIBRARY_DIR-NOTFOUND"
感谢您的帮助!
这自行解决了。显然,这是 CppKafka 库的一个错误,开发人员已经解决了。
我正在尝试在使用 CMake 构建的项目中使用 Kafka。
我安装了 librdkafka-dev(版本 0.8.6-1.1)。
我也尝试从 Git 下载项目并手动构建它,这似乎是成功的。
我注意到 librdkafka/packaging/cmake 中有一个 README.md 文件,并按照其说明在目录中成功创建了 librdkafka 的 CMake 版本。
运行 我项目中的 'cmake' 命令导致以下错误:
CMake Error at CMakeLists.txt:8 (find_package):
By not providing "Findlibrdkafka.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"librdkafka", but CMake did not find one.
Could not find a package configuration file provided by "librdkafka" with
any of the following names:
librdkafkaConfig.cmake
librdkafka-config.cmake
Add the installation prefix of "librdkafka" to CMAKE_PREFIX_PATH or set
"librdkafka_DIR" to a directory containing one of the above files. If
"librdkafka" provides a separate development package or SDK, be sure it has
been installed.
有可能 librdkafka 只是在 CMakeLists.txt 文件中查找 rdkafka 的错误包名称,但我还没有找到如何在不使用 Cppkafka 包装器的情况下将它添加到 CMake。
所以我尝试下载并构建 Cppkafka(运行 其目录文件夹中的 cmake ..
),结果出现以下错误:
-- Build will generate a shared library. Use CPPKAFKA_BUILD_SHARED=0 to perform a static build
-- RdKafkaConfig.cmake not found. Attempting to find module instead...
-- Could NOT find RDKAFKA (missing: RdKafka_LIBRARY_DIR)
-- Found valid rdkafka version
-- RdKafka module found.
-- Disabling tests because submodule Catch2 isn't checked out
-- Configuring done
CMake Error in src/CMakeLists.txt:
Target "RdKafka::rdkafka" contains relative path in its
INTERFACE_LINK_DIRECTORIES:
"RdKafka_LIBRARY_DIR-NOTFOUND"
感谢您的帮助!
这自行解决了。显然,这是 CppKafka 库的一个错误,开发人员已经解决了。