Skip to content

Commit 415c877

Browse files
authored
Merge pull request #264 from ddassie-texa/feature/msvc-debug-format-fix
2 parents 3108d5e + 398f901 commit 415c877

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Index.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
1313
cmake_policy(SET CMP0138 NEW)
1414
endif()
1515

16+
if(POLICY CMP0141)
17+
# MSVC debug information format flags are selected by an abstraction.
18+
cmake_policy(SET CMP0141 NEW)
19+
endif()
20+
1621
# only useable here
1722
set(ProjectOptions_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}")
1823

src/Sanitizers.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,19 @@ function(
8686
"Using MSVC sanitizers requires setting the MSVC environment before building the project. Please manually open the MSVC command prompt and rebuild the project."
8787
)
8888
endif()
89+
if(POLICY CMP0141)
90+
if("${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}" STREQUAL ""
91+
OR "${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}" STREQUAL "EditAndContinue"
92+
)
93+
set_target_properties(
94+
${_project_name} PROPERTIES MSVC_DEBUG_INFORMATION_FORMAT ProgramDatabase
95+
)
96+
endif()
97+
else()
98+
target_compile_options(${_project_name} INTERFACE /Zi)
99+
endif()
89100
target_compile_options(
90-
${_project_name} INTERFACE /fsanitize=${LIST_OF_SANITIZERS} /Zi /INCREMENTAL:NO
101+
${_project_name} INTERFACE /fsanitize=${LIST_OF_SANITIZERS} /INCREMENTAL:NO
91102
)
92103
target_link_options(${_project_name} INTERFACE /INCREMENTAL:NO)
93104
endif()

0 commit comments

Comments
 (0)