CMake-ing glog时缺少头文件

时间:2015-11-13 17:45:40

标签: c++ cmake gflags glog

我想在我的应用中使用日志记录。在我制作的CMake文件(相关部分见下文)中,一切运行顺利,gflags似乎安装好了。但是,在编译glog时,我收到错误消息:  致命错误:       找不到'gflags / gflags.h'文件

在生成的代码中找到丢失的文件,因此我猜有些开关/选项以某种不正确的方式设置。或者,我从错误的网站下载文件的另一件事。 (我发现并下载了几个已经存档的glog文件,它们都向我提供了不同的错误消息。)我该如何解决? (我更喜欢非手动补丁)

# Download and install GoogleFlags
ExternalProject_Add(
gflags
URL https://github.com/gflags/gflags/archive/master.zip
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gflags
INSTALL_COMMAND ""
)

# Create a libgflags target to be used as a dependency by test programs
add_library(libgflags IMPORTED STATIC GLOBAL)
add_dependencies(libgflags gflags)

# Set gflag properties
ExternalProject_Get_Property(gflags source_dir binary_dir)
set_target_properties(libgflags PROPERTIES
"IMPORTED_LOCATION" "${binary_dir}/libgflags.a"
"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
)
include_directories("${source_dir}/include")

# Download and install GoogleLog
ExternalProject_Add(
glog
URL https://github.com/emzeat/google-glog/archive/master.zip
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/glog
INSTALL_COMMAND ""
)

# Create a libglog target to be used as a dependency by test programs
add_library(libglog IMPORTED STATIC GLOBAL)
add_dependencies(libglog glog)

# Set glog properties
ExternalProject_Get_Property(glog source_dir binary_dir)
set_target_properties(libglog PROPERTIES
"IMPORTED_LOCATION" "${binary_dir}/libglog.a"
"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
#    "INTERFACE_INCLUDE_DIRECTORIES" "${source_dir}/include"
)
# I couldn't make it work with INTERFACE_INCLUDE_DIRECTORIES
include_directories("${source_dir}/include")

0 个答案:

没有答案