aboutsummaryrefslogtreecommitdiff
path: root/llvm/cmake/modules/LLVMProcessSources.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/cmake/modules/LLVMProcessSources.cmake')
-rw-r--r--llvm/cmake/modules/LLVMProcessSources.cmake20
1 files changed, 13 insertions, 7 deletions
diff --git a/llvm/cmake/modules/LLVMProcessSources.cmake b/llvm/cmake/modules/LLVMProcessSources.cmake
index a7f9517..cf358a8 100644
--- a/llvm/cmake/modules/LLVMProcessSources.cmake
+++ b/llvm/cmake/modules/LLVMProcessSources.cmake
@@ -58,13 +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_source_files_properties(${fn} PROPERTIES 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: