cmake: prefer linking against gflags::gflags (fixes #683)

This commit is contained in:
Sergiu Deitsch 2021-07-13 13:20:41 +02:00
parent 42ce901f28
commit 5bf7fdea16

View File

@ -630,7 +630,12 @@ if (HAVE_PTHREAD)
endif (HAVE_PTHREAD)
if (gflags_FOUND)
target_link_libraries (glog PUBLIC gflags)
# Prefer the gflags target that uses double colon convention
if (TARGET gflags::gflags)
target_link_libraries (glog PUBLIC gflags::gflags)
else (TARGET gflags::gflags)
target_link_libraries (glog PUBLIC gflags)
endif (TARGET gflags::gflags)
target_compile_definitions (glog PRIVATE
GFLAGS_DLL_DECLARE_FLAG=GOOGLE_GLOG_DLL_DECL