Find Glog in MacOS when only the static version is installed

This commit is contained in:
Carles Fernandez 2019-08-11 09:12:15 +02:00
parent fe6260df99
commit 66cabb83e5
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
1 changed files with 8 additions and 2 deletions

View File

@ -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}"