Cannot find 'gflags/gflags.h' while building library OSX

4.3k Views Asked by At

I'm trying to build the library which included 'gflags/gflags.h' and am having trouble getting it to find.

I installed gflags and glog with homebrew.

CMake output says:

-- 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

While running "cmake" everything is okay there is no error. But when I run "make install" it cannot build and it says "fatal error: 'gflags/gflags.h' file not found"

How can I build the library which requires gflags in OsX?

1

There are 1 best solutions below

1
Kevin On BEST ANSWER

First, find your package

find_package(Gflags REQUIRED)
find_package(Glog REQUIRED)

And then assign these library's header files to your executable include path

include_directories(${GLOG_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIRS})

Make sure that these variables are set properly

message(STATUS "GFLAGS include path: ${GFLAGS_INCLUDE_DIRS}")