3
# We will try to use the config mode first, and then manual find.
4
find_package(glog CONFIG QUIET)
5
if(NOT TARGET glog::glog)
6
find_package(glog MODULE QUIET)
10
message(STATUS "Caffe2: Found glog with new-style glog target.")
14
"Caffe2: Found glog with old-style glog starget. Glog never shipped "
15
"old style glog targets, so somewhere in your cmake path there might "
16
"be a custom Findglog.cmake file that got triggered. We will make a "
17
"best effort to create the new style glog target for you.")
18
add_library(glog::glog UNKNOWN IMPORTED)
20
TARGET glog::glog PROPERTY IMPORTED_LOCATION ${GLOG_LIBRARY})
22
TARGET glog::glog PROPERTY INTERFACE_INCLUDE_DIRECTORIES
25
message(STATUS "Caffe2: Cannot find glog automatically. Using legacy find.")
29
# The following variables are optionally searched for defaults
30
# GLOG_ROOT_DIR: Base directory where all GLOG components are found
32
# The following are set after configuration is done:
36
# GLOG_LIBRARYRARY_DIRS
38
include(FindPackageHandleStandardArgs)
39
set(GLOG_ROOT_DIR "" CACHE PATH "Folder contains Google glog")
41
find_path(GLOG_INCLUDE_DIR glog/logging.h
42
PATHS ${GLOG_ROOT_DIR})
45
find_library(GLOG_LIBRARY glog
46
PATHS ${GLOG_ROOT_DIR}
47
PATH_SUFFIXES lib lib64)
49
find_package_handle_standard_args(glog DEFAULT_MSG GLOG_INCLUDE_DIR GLOG_LIBRARY)
53
"Caffe2: Found glog (include: ${GLOG_INCLUDE_DIR}, "
54
"library: ${GLOG_LIBRARY})")
55
add_library(glog::glog UNKNOWN IMPORTED)
57
TARGET glog::glog PROPERTY IMPORTED_LOCATION ${GLOG_LIBRARY})
59
TARGET glog::glog PROPERTY INTERFACE_INCLUDE_DIRECTORIES
64
# After above, we should have the glog::glog target now.
65
if(NOT TARGET glog::glog)
67
"Caffe2: glog cannot be found. Depending on whether you are building "
68
"Caffe2 or a Caffe2 dependent library, the next warning / error will "
69
"give you more info.")