From 66cabb83e5cf1807ceabada9ff56d65c334f4913 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 11 Aug 2019 09:12:15 +0200 Subject: [PATCH] Find Glog in MacOS when only the static version is installed --- cmake/Modules/FindGLOG.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/FindGLOG.cmake b/cmake/Modules/FindGLOG.cmake index c2bcbdd38..4bbb381fb 100644 --- a/cmake/Modules/FindGLOG.cmake +++ b/cmake/Modules/FindGLOG.cmake @@ -85,6 +85,7 @@ macro(_FIND_GLOG_LIBRARIES _var) ${GLOG_ROOT}/lib64 $ENV{GLOG_ROOT}/lib64 ${PC_GLOG_LIBDIR} + /opt/local/lib PATH_SUFFIXES lib ) mark_as_advanced(${_var}) @@ -126,7 +127,7 @@ else() _find_glog_libraries(GLOG_LIBRARIES libglog.so) endif() if(APPLE) - _find_glog_libraries(GLOG_LIBRARIES libglog.dylib) + _find_glog_libraries(GLOG_LIBRARIES glog) endif() endif() @@ -167,8 +168,13 @@ set_package_properties(GLOG PROPERTIES URL "https://github.com/google/glog" ) +string(REGEX MATCH libglog.a GLOG_IS_STATIC ${GLOG_LIBRARIES}) if(GLOG_FOUND AND NOT TARGET Glog::glog) - add_library(Glog::glog SHARED IMPORTED) + if(GLOG_IS_STATIC) + add_library(Glog::glog STATIC IMPORTED) + else() + add_library(Glog::glog SHARED IMPORTED) + endif() set_target_properties(Glog::glog PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" IMPORTED_LOCATION "${GLOG_LIBRARIES}"