From eea9f42c80f40dbc236322ab320b4f8e33f93bc0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=84=B8=ED=9D=AC/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Principal=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Fri, 11 May 2018 08:57:28 +0900 Subject: [PATCH] Add glog target cmake configure file (#216) * Add glog target cmake configure file This will add glog configure file that adds glog target. Unlike gflags, latest glog source archieve has issue(namespace difference) with latest gflags so cannot use built from source glog at the moment. So this commit only includes adding target interface with system installed version. Download and build from source may be added later when isses are fixed somehow. Signed-off-by: SaeHie Park * move status message * remove empty line --- cmake/packages/GLogConfig.cmake | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 cmake/packages/GLogConfig.cmake diff --git a/cmake/packages/GLogConfig.cmake b/cmake/packages/GLogConfig.cmake new file mode 100644 index 0000000..61253a0 --- /dev/null +++ b/cmake/packages/GLogConfig.cmake @@ -0,0 +1,30 @@ +function(_GLog_import) + if(TARGET glog) + set(GLog_FOUND True PARENT_SCOPE) + return() + endif() + + nncc_find_package(GFlags REQUIRED) + if(NOT GFlags_FOUND) + set(GLog_FOUND False PARENT_SCOPE) + return() + endif(NOT GFlags_FOUND) + + set(GLOG_ROOT_DIR "" CACHE PATH "Folder contains Google Log") + find_path(GLOG_INCLUDE_DIR glog/logging.h PATHS ${GLOG_ROOT_DIR}) + find_library(GLOG_LIBRARY glog) + + if(NOT GLOG_INCLUDE_DIR) + set(GLog_FOUND False PARENT_SCOPE) + return() + endif(NOT GLOG_INCLUDE_DIR) + + add_library(glog INTERFACE) + target_include_directories(glog INTERFACE ${GLOG_INCLUDE_DIR} ${GFLAGS_INCLUDE_DIR}) + target_link_libraries(glog INTERFACE ${GLOG_LIBRARY} gflags) + + message(STATUS "Found GLog: TRUE") + set(GLog_FOUND True PARENT_SCOPE) +endfunction(_GLog_import) + +_GLog_import() -- 2.7.4