diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index 0f70a01014a11716732f9dd159b4e046ee26ea6e..cd268cd685f7d092f4f21257a9224dfe43f7cb78 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -82,10 +82,12 @@ QOpenGLTextureGlyphCache::~QOpenGLTextureGlyphCache()
     clear();
 }
 
+#if !defined(QT_OPENGL_ES_2)
 static inline bool isCoreProfile()
 {
     return QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile;
 }
+#endif
 
 void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
 {