[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:14:27 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.
+  if(NOT MSVC)
----------------
joker-eph wrote:

Won't this affect the non-MSBuild configuration as well?

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


More information about the llvm-commits mailing list