Fix VS 2026 Windows build

This commit is contained in:
2026-06-05 16:38:06 +02:00
parent 0e6c61e8a9
commit 26a2349c5f
4 changed files with 40 additions and 8 deletions

View File

@@ -315,6 +315,31 @@ if(PP_BUILD_APP)
target_include_directories(pp_legacy_vendor
PUBLIC
${PP_LEGACY_INCLUDE_DIRS})
if(MSVC_VERSION GREATER_EQUAL 1945)
set(PP_FMT_VS2026_COMPAT_INCLUDE_DIR
"${CMAKE_CURRENT_BINARY_DIR}/compat/fmt-vs2026/include")
set(PP_FMT_VS2026_COMPAT_FORMAT_H
"${PP_FMT_VS2026_COMPAT_INCLUDE_DIR}/fmt/format.h")
file(MAKE_DIRECTORY "${PP_FMT_VS2026_COMPAT_INCLUDE_DIR}")
file(COPY
"${CMAKE_CURRENT_SOURCE_DIR}/libs/fmt/include/fmt"
DESTINATION "${PP_FMT_VS2026_COMPAT_INCLUDE_DIR}")
file(READ
"${CMAKE_CURRENT_SOURCE_DIR}/libs/fmt/include/fmt/format.h"
PP_FMT_FORMAT_H)
# VS 2026 removed stdext::checked_array_iterator; keep the fmt
# submodule clean by disabling that legacy-only branch in the
# generated overlay.
string(REPLACE
"#ifdef _SECURE_SCL"
"#if 0"
PP_FMT_FORMAT_H
"${PP_FMT_FORMAT_H}")
file(WRITE "${PP_FMT_VS2026_COMPAT_FORMAT_H}" "${PP_FMT_FORMAT_H}")
target_include_directories(pp_legacy_vendor
BEFORE PRIVATE
"${PP_FMT_VS2026_COMPAT_INCLUDE_DIR}")
endif()
target_compile_definitions(pp_legacy_vendor
PUBLIC
ENUM_BITFIELDS_NOT_SUPPORTED