[llvm] [cmake] Don't generate per-file "__SHORT_FILE__" defines on MSVC builds (PR #151167)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 08:24:24 PDT 2025


================
@@ -58,14 +58,16 @@ function(llvm_process_sources OUT_VAR)
   set(sources ${ARG_UNPARSED_ARGUMENTS})
   llvm_check_source_file_list(${sources})
 
-  foreach(fn ${sources})
-    get_filename_component(suf ${fn} EXT)
-    if("${suf}" STREQUAL ".cpp" OR "${suf}" STREQUAL ".c")
-      get_filename_component(short_name ${fn} NAME)
-      set_source_files_properties(${fn} PROPERTIES COMPILE_DEFINITIONS "__SHORT_FILE__=\"${short_name}\"")
-    endif()
-  endforeach()
-
+  # Don't generate __SHORT_FILE__ on MSVC builds as it can force repeated cache regeneration.
----------------
RKSimon wrote:

I don't know enough about how cmake does its thing on visual studio - is it possible it gets run multiple times or something during the build? All I know is #150677 slowed everything to a crawl.

https://github.com/llvm/llvm-project/pull/151167


More information about the llvm-commits mailing list