From dda12bb1724d7338c66669fa2774a53c7eb6e66b Mon Sep 17 00:00:00 2001 From: Bruno Alexandre Rosa <1791393+brunoalr@users.noreply.github.com> Date: Mon, 2 Mar 2026 23:53:38 -0300 Subject: [PATCH] take 2 --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5454469ee..3d59f19ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,9 +143,15 @@ endif() # Define proper compilation flags if(MSVC) + # /Z7 when using compiler launcher (sccache): avoids C1041 PDB lock with parallel cached compiles + # /Zi /FS otherwise for Ninja + /MP parallel builds + if(CMAKE_CXX_COMPILER_LAUNCHER) + set(_msvc_debug_format " /Z7") + else() + set(_msvc_debug_format " /Zi /FS") + endif() # Disable Warning C4251, C++20 compatibility, Multi-threaded Builds, Warn Detection, Unwind Semantics, Debug Symbols - # /FS: Allow concurrent PDB writes (required for Ninja + /MP parallel builds) - set(CMAKE_CXX_FLAGS "/wd4251 /Zc:__cplusplus /std:c++20 /permissive- /W4 /MP /EHsc /Zi /FS") + set(CMAKE_CXX_FLAGS "/wd4251 /Zc:__cplusplus /std:c++20 /permissive- /W4 /MP /EHsc${_msvc_debug_format}") # Visual Studio: Maximum Optimization, Multi-threaded DLL set(CMAKE_CXX_FLAGS_RELEASE "/Ox /MD") # Visual Studio: No Optimization, Multi-threaded Debug DLL