diff --git a/CMakeLists.txt b/CMakeLists.txt index 561bbc127..166bc5107 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -483,6 +483,13 @@ set(SOURCES set(DEFINITIONS) set(SOURCES ${SOURCES} "imgui/imgui_impl_opengl3.cpp") set_source_files_properties("imgui/imgui_impl_opengl3.cpp" PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE) +# the settings (Global, GetGlobalSettings()) are a function-local static read everywhere all the time: MSVC's check of its +# thread-safe initialisation reads the thread's epoch from the TLS on every call. it's made once, by the main thread, before +# any other thread starts, so the plain check of the static does; the only function-local static of the file. without the +# precompiled header, which is built with the default +if(MSVC) + set_source_files_properties("utilities/Globals.cpp" PROPERTIES COMPILE_OPTIONS "/Zc:threadSafeInit-" SKIP_PRECOMPILE_HEADERS TRUE) +endif() if (WITH_CRASHPAD) set(DEFINITIONS ${DEFINITIONS} "WITH_CRASHPAD")