Merge pull request #4256 from niranjan-nilakantan:niranjan-nilakantan/issue4255

PiperOrigin-RevId: 536480185
Change-Id: I9bdd65cd18253703abf3cc92b3f354c1f798aa3e
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index e7927a3..a3fb3ca 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -104,10 +104,11 @@
     set(cxx_no_exception_flags "-fno-exceptions")
     set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Winline -Wredundant-decls")
     set(cxx_no_rtti_flags "-fno-rtti")
+    if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+      set(cxx_strict_flags "${cxx_strict_flags} -Wchar-subscripts")
+    endif()
     if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
       set(cxx_base_flags "${cxx_base_flags} -Wno-implicit-float-size-conversion -ffp-model=precise")
-    else()
-      set(cxx_strict_flags "${cxx_strict_flags} -Wchar-subscripts")
     endif()
   elseif (CMAKE_COMPILER_IS_GNUCXX)
     set(cxx_base_flags "-Wall -Wshadow -Wundef")