2012-12-24 02:33:50 +00:00
|
|
|
# - Try to find the Google Glog library
|
|
|
|
#
|
|
|
|
# This module defines the following variables
|
|
|
|
#
|
|
|
|
# GLOG_FOUND - Was Glog found
|
|
|
|
# GLOG_INCLUDE_DIRS - the Glog include directories
|
|
|
|
# GLOG_LIBRARIES - Link to this
|
|
|
|
#
|
|
|
|
# This module accepts the following variables
|
|
|
|
#
|
|
|
|
# GLOG_ROOT - Can be set to Glog install path or Windows build path
|
|
|
|
#
|
|
|
|
|
|
|
|
if (NOT DEFINED GLOG_ROOT)
|
2012-12-24 10:19:11 +00:00
|
|
|
set (GLOG_ROOT /usr /usr/local)
|
2012-12-24 02:33:50 +00:00
|
|
|
endif (NOT DEFINED GLOG_ROOT)
|
|
|
|
|
|
|
|
if(MSVC)
|
2012-12-24 10:19:11 +00:00
|
|
|
set(LIB_PATHS ${GLOG_ROOT} ${GLOG_ROOT}/Release)
|
2012-12-24 02:33:50 +00:00
|
|
|
else(MSVC)
|
2012-12-24 10:19:11 +00:00
|
|
|
set (LIB_PATHS ${GLOG_ROOT} ${GLOG_ROOT}/lib)
|
2012-12-24 02:33:50 +00:00
|
|
|
endif(MSVC)
|
|
|
|
|
|
|
|
macro(_FIND_GLOG_LIBRARIES _var)
|
2012-12-24 10:19:11 +00:00
|
|
|
find_library(${_var}
|
2014-05-11 12:50:57 +00:00
|
|
|
NAMES ${ARGN}
|
2016-11-05 12:40:44 +00:00
|
|
|
PATHS ${LIB_PATHS}
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/lib/x86_64-linux-gnu
|
|
|
|
/usr/lib/i386-linux-gnu
|
|
|
|
/usr/lib/arm-linux-gnueabihf
|
|
|
|
/usr/lib/arm-linux-gnueabi
|
|
|
|
/usr/lib/aarch64-linux-gnu
|
|
|
|
/usr/lib/mipsel-linux-gnu
|
|
|
|
/usr/lib/mips-linux-gnu
|
|
|
|
/usr/lib/mips64el-linux-gnuabi64
|
|
|
|
/usr/lib/powerpc-linux-gnu
|
|
|
|
/usr/lib/powerpc64-linux-gnu
|
|
|
|
/usr/lib/powerpc64le-linux-gnu
|
|
|
|
/usr/lib/powerpc-linux-gnuspe
|
|
|
|
/usr/lib/hppa-linux-gnu
|
|
|
|
/usr/lib/s390x-linux-gnu
|
|
|
|
/usr/lib/i386-gnu
|
|
|
|
/usr/lib/hppa-linux-gnu
|
|
|
|
/usr/lib/x86_64-kfreebsd-gnu
|
|
|
|
/usr/lib/i386-kfreebsd-gnu
|
|
|
|
/usr/lib/m68k-linux-gnu
|
|
|
|
/usr/lib/sh4-linux-gnu
|
|
|
|
/usr/lib/sparc64-linux-gnu
|
|
|
|
/usr/lib/x86_64-linux-gnux32
|
|
|
|
/usr/lib/alpha-linux-gnu
|
|
|
|
/usr/lib64
|
|
|
|
/usr/lib
|
2014-05-11 12:50:57 +00:00
|
|
|
PATH_SUFFIXES lib
|
2012-12-24 10:19:11 +00:00
|
|
|
)
|
|
|
|
mark_as_advanced(${_var})
|
2012-12-24 02:33:50 +00:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(_GLOG_APPEND_LIBRARIES _list _release)
|
|
|
|
set(_debug ${_release}_DEBUG)
|
|
|
|
if(${_debug})
|
2012-12-24 10:19:11 +00:00
|
|
|
set(${_list} ${${_list}} optimized ${${_release}} debug ${${_debug}})
|
2012-12-24 02:33:50 +00:00
|
|
|
else()
|
2012-12-24 10:19:11 +00:00
|
|
|
set(${_list} ${${_list}} ${${_release}})
|
2012-12-24 02:33:50 +00:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
if(MSVC)
|
2014-12-07 11:10:24 +00:00
|
|
|
find_path(GLOG_INCLUDE_DIR NAMES raw_logging.h
|
2012-12-24 10:19:11 +00:00
|
|
|
PATHS
|
|
|
|
${GLOG_ROOT}/src/windows
|
|
|
|
${GLOG_ROOT}/src/windows/glog
|
|
|
|
)
|
2012-12-24 02:33:50 +00:00
|
|
|
else(MSVC)
|
2012-12-24 10:19:11 +00:00
|
|
|
# Linux/OS X builds
|
2014-12-07 11:10:24 +00:00
|
|
|
find_path(GLOG_INCLUDE_DIR NAMES raw_logging.h
|
2012-12-24 10:19:11 +00:00
|
|
|
PATHS
|
|
|
|
${GLOG_ROOT}/include/glog
|
2014-12-07 11:19:02 +00:00
|
|
|
/usr/include/glog
|
2014-05-11 12:50:57 +00:00
|
|
|
/opt/local/include/glog # default location in Macports
|
2012-12-24 10:19:11 +00:00
|
|
|
)
|
2012-12-24 02:33:50 +00:00
|
|
|
endif(MSVC)
|
|
|
|
|
|
|
|
# Find the libraries
|
|
|
|
if(MSVC)
|
2012-12-24 10:19:11 +00:00
|
|
|
_FIND_GLOG_LIBRARIES(GLOG_LIBRARIES libglog.lib)
|
2012-12-24 02:33:50 +00:00
|
|
|
else(MSVC)
|
2012-12-24 10:19:11 +00:00
|
|
|
# Linux/OS X builds
|
|
|
|
if(UNIX)
|
|
|
|
_FIND_GLOG_LIBRARIES(GLOG_LIBRARIES libglog.so)
|
|
|
|
endif(UNIX)
|
|
|
|
if(APPLE)
|
|
|
|
_FIND_GLOG_LIBRARIES(GLOG_LIBRARIES libglog.dylib)
|
|
|
|
endif(APPLE)
|
2012-12-24 02:33:50 +00:00
|
|
|
endif(MSVC)
|
|
|
|
|
2014-11-09 20:11:48 +00:00
|
|
|
if(GLOG_FOUND)
|
|
|
|
message(STATUS "glog library found at ${GLOG_LIBRARIES}")
|
|
|
|
endif()
|
2012-12-24 02:33:50 +00:00
|
|
|
|
|
|
|
# handle the QUIETLY and REQUIRED arguments and set GLOG_FOUND to TRUE if
|
|
|
|
# all listed variables are TRUE
|
|
|
|
include("${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake")
|
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Glog DEFAULT_MSG
|
2012-12-24 10:19:11 +00:00
|
|
|
GLOG_LIBRARIES)
|
2012-12-24 02:33:50 +00:00
|
|
|
|
|
|
|
if(MSVC)
|
2012-12-24 10:19:11 +00:00
|
|
|
string(REGEX REPLACE "/glog$" "" VAR_WITHOUT ${GLOG_INCLUDE_DIR})
|
|
|
|
string(REGEX REPLACE "/windows$" "" VAR_WITHOUT ${VAR_WITHOUT})
|
|
|
|
set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIRS} "${VAR_WITHOUT}")
|
|
|
|
string(REGEX REPLACE "/libglog.lib" "" GLOG_LIBRARIES_DIR ${GLOG_LIBRARIES})
|
2012-12-24 02:33:50 +00:00
|
|
|
else(MSVC)
|
2012-12-24 10:19:11 +00:00
|
|
|
# Linux/OS X builds
|
|
|
|
set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
|
|
|
|
string(REGEX REPLACE "/libglog.so" "" GLOG_LIBRARIES_DIR ${GLOG_LIBRARIES})
|
2012-12-24 02:33:50 +00:00
|
|
|
endif(MSVC)
|
|
|
|
|
|
|
|
if(GLOG_FOUND)
|
2012-12-24 10:19:11 +00:00
|
|
|
# _GLOG_APPEND_LIBRARIES(GLOG GLOG_LIBRARIES)
|
2012-12-24 02:33:50 +00:00
|
|
|
endif()
|