Skip to content

Commit 6c2b9f3

Browse files
authored
Don't force /Zi when using CMAKE_MSVC_DEBUG_INFORMATION_FORMAT (microsoft#7041)
Newer versions of CMake have a more robust way of handling debug information settings for Windows. Forcing this on breaks the ability to control how debug info is generated and gets in the way of using sccache. See CMake's docs: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT.html
1 parent 7786737 commit 6c2b9f3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmake/modules/HandleLLVMOptions.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,11 @@ if( MSVC )
357357

358358
# Change release to always build debug information out-of-line, but
359359
# also enable Reference optimization, ie dead function elimination.
360-
append("/Zi" CMAKE_CXX_FLAGS_RELEASE)
361-
append("/DEBUG /OPT:REF" CMAKE_SHARED_LINKER_FLAGS_RELEASE)
362-
append("/DEBUG /OPT:REF" CMAKE_EXE_LINKER_FLAGS_RELEASE)
360+
if (NOT CMAKE_MSVC_DEBUG_INFORMATION_FORMAT)
361+
append("/Zi" CMAKE_CXX_FLAGS_RELEASE)
362+
append("/DEBUG /OPT:REF" CMAKE_SHARED_LINKER_FLAGS_RELEASE)
363+
append("/DEBUG /OPT:REF" CMAKE_EXE_LINKER_FLAGS_RELEASE)
364+
endif()
363365

364366
# HLSL Changes End
365367

0 commit comments

Comments
 (0)