我已经在macOS上安装了libevent-
$ brew install libevent
我正在尝试将其导入到我的CMakeLists.txt中-
cmake_minimum_required(VERSION 3.14)
project(xyz)
set(CMAKE_CXX_STANDARD 17)
find_package(libevent REQUIRED)
我得到以下CMake错误-
CMake Error at CMakeLists.txt:6 (find_package):
By not providing "Findlibevent.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "libevent",
but CMake did not find one.
Could not find a package configuration file provided by "libevent" with any
of the following names:
libeventConfig.cmake
libevent-config.cmake
Add the installation prefix of "libevent" to CMAKE_PREFIX_PATH or set
"libevent_DIR" to a directory containing one of the above files. If
"libevent" provides a separate development package or SDK, be sure it has
been installed.
有人能告诉我如何在CMake中导入安装在系统中的libevent吗?
2条答案
按热度按时间jhdbpxl91#
我也有同样的问题,但我通过添加来解决这个问题:
它只是告诉Makefile在哪里可以找到libevent头和库。
goucqfw62#
1.必须安装pkg-config
1.然后在CMakeList.txt中