From 06a2420ae769d6a34ce9c1445076bfaf0dfbb041 Mon Sep 17 00:00:00 2001 From: crueter Date: Wed, 1 Apr 2026 04:28:45 -0400 Subject: [PATCH] Limit on MSVC Signed-off-by: crueter --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a482f78aec..8a75496bc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,15 @@ endif() option(ENABLE_UNITY_BUILD "Enable Unity/Jumbo build" OFF) # 0 compiles all files in -set(UNITY_BATCH_SIZE 0 CACHE STRING "Unity build batch size") +# not ideal, but if you're going gung-ho with a unity build, expect failure +# MSVC physically can't compile that many files into one TU, so we limit it to 100. +if (MSVC) + set(_unity_default 100) +else() + set(_unity_default 0) +endif() + +set(UNITY_BATCH_SIZE ${_unity_default} CACHE STRING "Unity build batch size") if(MSVC AND ENABLE_UNITY_BUILD) message(STATUS "Unity build")