Skip to content

Commit 13c966b

Browse files
committed
Windows: workaround for mutex crash when building with VS 2022 17.10 or newer.
1 parent 65e864b commit 13c966b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ elseif(MSVC)
306306
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
307307
message(STATUS "Building with static CRT.")
308308
endif()
309+
# Workaround: When building on VS 2022 17.10 or newer, but using an older runtime,
310+
# mutexes can crash
311+
# https://stackoverflow.com/questions/78598141/first-stdmutexlock-crashes-in-application-built-with-latest-visual-studio
312+
add_definitions(-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
309313
endif()
310314
if(CLANG) # clang all platforms
311315
set(CMAKE_CXX_FLAGS_RELEASE

0 commit comments

Comments
 (0)