Fix crashes in combination with older MSVC redistributable versions

Since the switch of Windows 2022 GitHub actions runner image to version
20240603.1.1 the Visual Studio version was bumped to 17.10.34928.147.
This results in MSVC version 19.40.33811.0 being used at build time.
Combining this with e.g. the MSVC redistributable version 14.34.31938.0
results in segfaults when calling std::mutex::lock.

See also:
https://developercommunity.visualstudio.com/t/Invalid-code-generation-in-release-1940/10678572
This commit is contained in:
WarmUpTill
2024-06-08 23:15:21 +02:00
parent 7b48cb2b8d
commit ed75a221fe

View File

@@ -345,6 +345,9 @@ if(OS_WINDOWS)
if(MSVC)
target_compile_options(${LIB_NAME} PUBLIC /MP /d2FH4- /wd4267 /wd4267
/bigobj)
# Workaround for MSVC incompatibility in CI environment
add_compile_definitions(${target_name} _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
endif()
target_sources(${LIB_NAME} PRIVATE lib/win/advanced-scene-switcher-win.cpp)
add_definitions(-D_WEBSOCKETPP_CPP11_STL_)