MSVC: Prevent C1041 error

error C1041: cannot open program database '....'; if multiple CL.EXE write to the same .PDB file, please use /FS
might be output in some conditions, add /FS compiler flag to prevent it.

Fixes Issue: #796
Fix By: Brad House (@bradh352)
pull/797/head
Brad House 5 months ago
parent cd1ff7b2f3
commit 7d6de797d1
  1. 9
      CMakeLists.txt

@ -62,8 +62,8 @@ ENDIF ()
INCLUDE (EnableWarnings)
# allow linking against the static runtime library in msvc
IF (MSVC)
# allow linking against the static runtime library in msvc
OPTION (CARES_MSVC_STATIC_RUNTIME "Link against the static runtime library" OFF)
IF (CARES_MSVC_STATIC_RUNTIME)
# CMAKE_CONFIGURATION_TYPES is empty on non-IDE generators (Ninja, NMake)
@ -77,6 +77,13 @@ IF (MSVC)
ENDIF ()
ENDFOREACH ()
# Prevent: error C1041: cannot open program database '....'; if multiple CL.EXE write to the same .PDB file, please use /FS
FOREACH (config_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
STRING (TOUPPER ${config_type} upper_config_type)
SET (flag_var "CMAKE_C_FLAGS_${upper_config_type}")
SET (${flag_var} "${${flag_var}} /FS")
ENDFOREACH ()
# clean up
SET (upper_config_type)
SET (config_type)

Loading…
Cancel
Save