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:
@@ -40,12 +40,28 @@ function(yaze_add_compiler_flags)
|
|||||||
|
|
||||||
# Compiler-specific settings
|
# Compiler-specific settings
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(yaze_common INTERFACE
|
# Check if we're using clang-cl (Clang with MSVC-compatible command line)
|
||||||
/EHsc
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
/W4 /permissive-
|
# clang-cl requires explicit /std:c++latest to access C++23 features including <filesystem>
|
||||||
/bigobj
|
# Without this, clang-cl only sees std::experimental::filesystem from older MSVC STL
|
||||||
/utf-8
|
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
|
target_compile_definitions(yaze_common INTERFACE
|
||||||
_CRT_SECURE_NO_WARNINGS
|
_CRT_SECURE_NO_WARNINGS
|
||||||
_CRT_NONSTDC_NO_WARNINGS
|
_CRT_NONSTDC_NO_WARNINGS
|
||||||
|
|||||||
Reference in New Issue
Block a user