diff --git a/Telegram/cmake/qrhi_shaders.cmake b/Telegram/cmake/qrhi_shaders.cmake
index 393cd5065e..bfc9309ffc 100644
--- a/Telegram/cmake/qrhi_shaders.cmake
+++ b/Telegram/cmake/qrhi_shaders.cmake
@@ -62,8 +62,18 @@ foreach(_src ${_shader_sources})
endforeach()
list(SORT _qrc_entries)
list(JOIN _qrc_entries "\n" _qrc_body)
-file(WRITE "${_qsb_out_dir}/shaders.qrc"
- "\n \n${_qrc_body}\n \n\n")
+# Write shaders.qrc at configure time (so AUTORCC can scan its INPUTS) but
+# only touch the file when content actually changes — otherwise AUTORCC sees
+# a fresh mtime on every cmake re-generate and re-runs rcc unnecessarily.
+set(_qrc_path "${_qsb_out_dir}/shaders.qrc")
+set(_qrc_new "\n \n${_qrc_body}\n \n\n")
+set(_qrc_old "")
+if (EXISTS "${_qrc_path}")
+ file(READ "${_qrc_path}" _qrc_old)
+endif()
+if (NOT "${_qrc_new}" STREQUAL "${_qrc_old}")
+ file(WRITE "${_qrc_path}" "${_qrc_new}")
+endif()
add_custom_target(compile_shaders DEPENDS ${_qsb_outputs})
nice_target_sources(Telegram ${_qsb_out_dir}
PRIVATE