CMake: Break on GLib criticals by default in MSVC

Set G_DEBUG=fatal-criticals environment variable when debugging with
Visual Studio. Setting the environment variable conveniently triggers
breakpoint whenever there is a programmer error.
This commit is contained in:
Tomasz Moń 2022-08-15 21:05:33 +02:00 committed by Gerald Combs
parent 0b068f3b06
commit 12bb2788f9
1 changed files with 8 additions and 0 deletions

View File

@ -4044,6 +4044,14 @@ configure_file(
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
# Break on programmer errors when debugging in Visual Studio
if(MSVC)
get_property(_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS)
foreach(_target ${_targets})
set_target_properties(${_target} PROPERTIES VS_DEBUGGER_ENVIRONMENT "G_DEBUG=fatal-criticals")
endforeach()
endif()
#
# Editor modelines - https://www.wireshark.org/tools/modelines.html
#