Skip to content

Commit cde9e79

Browse files
committed
correct CMAKE_MSVC_DEBUG_INFORMATION_FORMAT logic hence make it work without need to specify debug format flags with ClangCL by hand, enforce ProgramDatabase regardless the case (https://gitlab.kitware.com/cmake/cmake/-/issues/26879#note_1649970)
1 parent a2a7e72 commit cde9e79

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@ option(NBL_STATIC_BUILD "" OFF) # ON for static builds, OFF for shared
2424
option(NBL_COMPILER_DYNAMIC_RUNTIME "" ON)
2525
option(NBL_SANITIZE_ADDRESS OFF)
2626

27-
if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
28-
if(NBL_SANITIZE_ADDRESS)
29-
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>")
30-
else()
31-
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug>:EditAndContinue>$<$<CONFIG:RelWithDebInfo>:ProgramDatabase>")
32-
endif()
33-
endif()
27+
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT $<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>) # ignored on non xMSVC-ABI targets
3428

3529
if(NBL_STATIC_BUILD)
3630
message(STATUS "Static Nabla build enabled!")

cmake/adjust/flags.cmake

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -305,17 +305,10 @@ function(nbl_adjust_flags)
305305

306306
set(MAPPED_CONFIG $<TARGET_GENEX_EVAL:${NBL_TARGET_ITEM},$<TARGET_PROPERTY:${NBL_TARGET_ITEM},NBL_CONFIGURATION_MAP>>)
307307

308-
if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
309-
if(NBL_SANITIZE_ADDRESS)
310-
set(NBL_TARGET_MSVC_DEBUG_INFORMATION_FORMAT "$<$<OR:$<STREQUAL:${MAPPED_CONFIG},DEBUG>,$<STREQUAL:${MAPPED_CONFIG},RELWITHDEBINFO>>:ProgramDatabase>")
311-
else()
312-
set(NBL_TARGET_MSVC_DEBUG_INFORMATION_FORMAT "$<$<STREQUAL:${MAPPED_CONFIG},DEBUG>:EditAndContinue>$<$<STREQUAL:${MAPPED_CONFIG},RELWITHDEBINFO>:ProgramDatabase>")
313-
endif()
314-
endif()
315-
316308
set_target_properties(${NBL_TARGET_ITEM} PROPERTIES
317-
MSVC_DEBUG_INFORMATION_FORMAT "${NBL_TARGET_MSVC_DEBUG_INFORMATION_FORMAT}"
318-
)
309+
MSVC_DEBUG_INFORMATION_FORMAT $<$<OR:$<STREQUAL:${MAPPED_CONFIG},DEBUG>,$<STREQUAL:${MAPPED_CONFIG},RELWITHDEBINFO>>:ProgramDatabase> # ignored on non xMSVC-ABI targets
310+
)
311+
319312
math(EXPR _NBL_ARG_I_ "${_NBL_ARG_I_} + 1")
320313
endwhile()
321314
else() # DIRECTORY mode

cmake/adjust/template/vendor/impl/Clang.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ endif()
6868
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES MSVC)
6969
# ClangCL with MSVC frontend (most of the options are compatible but eg /arch:SSE4.2 seems to be not)
7070
include("${CMAKE_CURRENT_LIST_DIR}/frontend/MSVC.cmake")
71-
72-
# https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT.html
73-
# should be set with CMAKE_MSVC_DEBUG_INFORMATION_FORMAT but for some reason it doesn't respect with ClangCL even though its MSVC frontend
74-
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.html#variable:CMAKE_%3CLANG%3E_COMPILER_FRONTEND_VARIANT
75-
NBL_REQUEST_COMPILE_OPTION_SUPPORT(LANG ${LANG} CONFIG DEBUG RELWITHDEBINFO COMPILE_OPTIONS /Zi)
7671
return()
7772
else()
7873
if(NBL_REQUEST_SSE_AVX2)

0 commit comments

Comments
 (0)