[llvm] 9a84c62 - [cmake] Don't generate per-file "__SHORT_FILE__" defines on visual studio builds (#151167)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 30 09:10:26 PDT 2025
Author: Simon Pilgrim
Date: 2025-07-30T17:10:23+01:00
New Revision: 9a84c62da4e8bcf76c39077e0c18f21dd724e9ab
URL: https://github.com/llvm/llvm-project/commit/9a84c62da4e8bcf76c39077e0c18f21dd724e9ab
DIFF: https://github.com/llvm/llvm-project/commit/9a84c62da4e8bcf76c39077e0c18f21dd724e9ab.diff
LOG: [cmake] Don't generate per-file "__SHORT_FILE__" defines on visual studio builds (#151167)
As reported on #150677 - this is preventing msbuild parallelization as cmake is repeatedly being updated
Added:
Modified:
llvm/cmake/modules/LLVMProcessSources.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/modules/LLVMProcessSources.cmake b/llvm/cmake/modules/LLVMProcessSources.cmake
index 6282b26bddded..cf358a88f5fb6 100644
--- a/llvm/cmake/modules/LLVMProcessSources.cmake
+++ b/llvm/cmake/modules/LLVMProcessSources.cmake
@@ -58,16 +58,19 @@ 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_property(
- SOURCE ${fn}
- APPEND
- PROPERTY COMPILE_DEFINITIONS __SHORT_FILE__="${short_name}")
- endif()
- endforeach()
+ # Don't generate __SHORT_FILE__ on VS builds as it can prevent build parallelisation.
+ if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+ 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_property(
+ SOURCE ${fn}
+ APPEND
+ PROPERTY COMPILE_DEFINITIONS __SHORT_FILE__="${short_name}")
+ endif()
+ endforeach()
+ endif()
# This adds .td and .h files to the Visual Studio solution:
More information about the llvm-commits
mailing list