Skip to content

Commit

Permalink
Merge pull request #264 from ddassie-texa/feature/msvc-debug-format-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Aug 12, 2024
2 parents 3108d5e + 398f901 commit 415c877
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Index.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0138 NEW)
endif()

if(POLICY CMP0141)
# MSVC debug information format flags are selected by an abstraction.
cmake_policy(SET CMP0141 NEW)
endif()

# only useable here
set(ProjectOptions_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}")

Expand Down
13 changes: 12 additions & 1 deletion src/Sanitizers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,19 @@ function(
"Using MSVC sanitizers requires setting the MSVC environment before building the project. Please manually open the MSVC command prompt and rebuild the project."
)
endif()
if(POLICY CMP0141)
if("${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}" STREQUAL ""
OR "${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}" STREQUAL "EditAndContinue"
)
set_target_properties(
${_project_name} PROPERTIES MSVC_DEBUG_INFORMATION_FORMAT ProgramDatabase
)
endif()
else()
target_compile_options(${_project_name} INTERFACE /Zi)
endif()
target_compile_options(
${_project_name} INTERFACE /fsanitize=${LIST_OF_SANITIZERS} /Zi /INCREMENTAL:NO
${_project_name} INTERFACE /fsanitize=${LIST_OF_SANITIZERS} /INCREMENTAL:NO
)
target_link_options(${_project_name} INTERFACE /INCREMENTAL:NO)
endif()
Expand Down

0 comments on commit 415c877

Please sign in to comment.