From: Kunal Pathak Date: Mon, 15 May 2023 12:42:28 +0000 (-0700) Subject: Use /INCREMENTAL:NO for Debug (#86170) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~2240 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef2d067e02dfb754c22933c76b81de02ea9ec5a3;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Use /INCREMENTAL:NO for Debug (#86170) * Use /INCREMENTAL:NO for Debug when using Visual Studio generator --------- Co-authored-by: Juan Hoyos <19413848+hoyosjs@users.noreply.github.com> Co-authored-by: Aaron Robinson Co-authored-by: Jasper --- diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 0282e29..fbe60f7 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -85,6 +85,15 @@ if (MSVC) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /sourcelink:${CLR_SOURCELINK_FILE_PATH}") endif(EXISTS ${CLR_SOURCELINK_FILE_PATH}) + if (CMAKE_GENERATOR MATCHES "^Visual Studio.*$") + # Debug build specific flags + # 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:NOICF DEBUG) + endif (CMAKE_GENERATOR MATCHES "^Visual Studio.*$") + # Checked build specific flags add_linker_flag(/INCREMENTAL:NO CHECKED) # prevent "warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:REF' specification" add_linker_flag(/OPT:REF CHECKED)