diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template
index 20c1b2797d776d5cd4ad516129e89f75b9c1de59..a326f36fe939068a3f025b05aaf535656ca1ed88 100644
--- a/templates/CMakeLists.txt.template
+++ b/templates/CMakeLists.txt.template
@@ -210,8 +210,8 @@
     endif()
     if(EXISTS "<%text>${GFLAGS_ROOT_DIR}</%text>/CMakeLists.txt")
         add_subdirectory(<%text>${GFLAGS_ROOT_DIR}</%text> third_party/gflags)
-        if(TARGET gflags-static)
-            set(_gRPC_GFLAGS_LIBRARIES gflags-static)
+        if(TARGET gflags_static)
+            set(_gRPC_GFLAGS_LIBRARIES gflags_static)
         endif()
     else()
         message(WARNING "gRPC_GFLAGS_PROVIDER is \"module\" but GFLAGS_ROOT_DIR is wrong")