我已经在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吗?
发布于 2020-02-02 23:31:25
我也有同样的问题,但我通过添加以下内容来解决这个问题:
link_directories(
/usr/local/lib
/usr/lib
)
INCLUDE_DIRECTORIES(
/usr/local/include/
/usr/include
)它只是告诉Makefile在哪里可以找到libevent头文件和库。
https://stackoverflow.com/questions/56422811
复制相似问题