Merge pull request #684 from sergiud/cmake-namespaced-gflags

cmake: prefer linking against gflags::gflags (fixes #683)
This commit is contained in:
Sergiu Deitsch 2021-07-14 10:39:54 +02:00 committed by GitHub
commit a01d739ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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