fix(windows): add /std:c++latest flag for clang-cl to enable std::filesystem

Root cause: clang-cl on Windows Server 2022 with MSVC STL cannot find
std::filesystem without explicit C++ standard flag. The compiler defaults
to an older compatibility mode that only exposes std::experimental::filesystem.

Solution: Add /std:c++latest compiler flag specifically for clang-cl builds
on Windows. This enables proper C++23 standard library support including
std::filesystem from MSVC STL.

The fix is applied via yaze_common interface target in cmake/utils.cmake,
ensuring all targets using yaze_common get the correct flags.

This has blocked Windows releases for 2+ weeks. Fixes compilation errors in:
- src/util/platform_paths.h
- src/util/platform_paths.cc
- src/util/file_util.cc
- All other files using <filesystem>

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
scawful
2025-11-20 01:36:08 -05:00
parent fa3da8fc27
commit b556b155a5

View File

@@ -40,12 +40,28 @@ function(yaze_add_compiler_flags)
# Compiler-specific settings
if(MSVC)
target_compile_options(yaze_common INTERFACE
/EHsc
/W4 /permissive-
/bigobj
/utf-8
)
# Check if we're using clang-cl (Clang with MSVC-compatible command line)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# clang-cl requires explicit /std:c++latest to access C++23 features including <filesystem>
# Without this, clang-cl only sees std::experimental::filesystem from older MSVC STL
target_compile_options(yaze_common INTERFACE
/EHsc
/W4 /permissive-
/bigobj
/utf-8
/std:c++latest
)
message(STATUS "Windows clang-cl: Added /std:c++latest for C++23 and std::filesystem support")
else()
# Regular MSVC compiler
target_compile_options(yaze_common INTERFACE
/EHsc
/W4 /permissive-
/bigobj
/utf-8
)
endif()
target_compile_definitions(yaze_common INTERFACE
_CRT_SECURE_NO_WARNINGS
_CRT_NONSTDC_NO_WARNINGS