From ed75a221fe0e9ebde3d1b812a206c9ce5027a0bd Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Sat, 8 Jun 2024 23:15:21 +0200 Subject: [PATCH] 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 --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8cb10d00..60dd9844e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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_)