From fea42aca0be008f52003bed5b573ff64e315fdee Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Thu, 5 Oct 2023 11:23:02 +0200 Subject: [PATCH] Pass /OPT:NOREF for DEBUG VS builds /OPT:REF will cause the linker to optimize out unused functions/statics, which is not desirable when debugging where you may want to be able to use and inspect those members from the debugger. --- eng/native/configurecompiler.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 6fe1e183e6211..6fc480fb20aab 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -118,7 +118,7 @@ if (MSVC) # The Ninja generator doesn't appear to have the default `/INCREMENTAL:ON` that # the Visual Studio generator has. Therefore we will override the default for Visual Studio only. add_linker_flag(/INCREMENTAL:NO DEBUG) - add_linker_flag(/OPT:REF DEBUG) + add_linker_flag(/OPT:NOREF DEBUG) add_linker_flag(/OPT:NOICF DEBUG) endif (CMAKE_GENERATOR MATCHES "^Visual Studio.*$")