From 5bf7fdea16be0db6eba80ecfafeb56fa6d7f19fd Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Tue, 13 Jul 2021 13:20:41 +0200 Subject: [PATCH] cmake: prefer linking against gflags::gflags (fixes #683) --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f3d485..5cafe39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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