我正在尝试构建包含'gflags/gflags.h'
的库,但很难找到它。
我用自制软件安装了gflags和glog。
CMake输出说:
-- Found installed version of gflags: /usr/local/lib/cmake/gflags
-- Detected gflags version: 2.2.2
-- Found Gflags: /usr/local/include
-- Found Glog: /usr/local/include
运行"cmake"
时一切正常,没有错误。但是当我运行"make install"
时,它无法构建,并显示"fatal error: 'gflags/gflags.h' file not found"
如何在OsX中构建需要gflags的库?
答案 0 :(得分:4)
首先,找到您的包裹
find_package(Gflags REQUIRED)
find_package(Glog REQUIRED)
然后将这些库的头文件分配给您的可执行文件包含路径
include_directories(${GLOG_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIRS})
确保这些变量设置正确
message(STATUS "GFLAGS include path: ${GFLAGS_INCLUDE_DIRS}")