From 20fe9cf7e995880376fbf02207e63762b74890a8 Mon Sep 17 00:00:00 2001 From: David Geldreich Date: Thu, 4 Aug 2022 14:51:22 +0200 Subject: Swift: Disable optimization when compiling in Debug By default no `-O...` flag is specified for Debug configuration for Swift so Xcode adds a (wrong) `-O` flag that prevents one from accessing variables while debugging. Add `-Onone` to the Swift Debug configuration to avoid this. Fixes: #23818 --- Modules/CMakeSwiftInformation.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index ecad1d5..16726d2 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -65,7 +65,7 @@ set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -libc MD) set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -libc MTd) set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -libc MDd) -set(CMAKE_Swift_FLAGS_DEBUG_INIT "-g") +set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g") set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O") set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g") set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize") -- cgit v0.12