修正Visual Studio 编译器的 PDB 文件锁冲突

(cherry picked from commit 62ab152d639509119db5edd742765bd3bec575bc)
This commit is contained in:
2025-10-29 15:40:47 +08:00
committed by speakeloudest
parent 1970bbb6fd
commit 0067017ca6
+3 -1
View File
@@ -11,6 +11,8 @@ set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} /MT")
# 添加编码和警告处理
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4819 /wd4244 /wd4458")
# 添加 /FS 标志以支持并行编译时的 PDB 文件访问(解决 C1041 错误)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FS")
# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
@@ -50,7 +52,7 @@ add_definitions(-DUNICODE -D_UNICODE)
function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100" /wd"4819" /wd"4244" /wd"4458")
target_compile_options(${TARGET} PRIVATE /EHsc /utf-8)
target_compile_options(${TARGET} PRIVATE /EHsc /utf-8 /FS)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
# 确保目标使用静态链接