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

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 08:15:49 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.
----------------
joker-eph wrote:

Can you provide more info on the "repeated cache generation" aspect? You mentioned before that the build would come to a halt which seems a bit different than a cache problem?
At least link to the discussion on the original PR maybe?

It's not clear to me that someone reading this right now would even connect the dots to MSBuild-specific issue.

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


More information about the llvm-commits mailing list