From 19196ca87c2bbe9aab40b37f7a519aeae1c30cf6 Mon Sep 17 00:00:00 2001 From: scawful Date: Thu, 20 Nov 2025 01:01:54 -0500 Subject: [PATCH] fix: Windows std::filesystem support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Explicitly set CXX_STANDARD 23 on yaze_util target - Add filesystem library linking for older GCC (< 9.0) - Add compile-time check for filesystem header on Windows - Helps diagnose clang-cl standard library path issues Addresses Windows build failures that have blocked releases for 2+ weeks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/util/util.cmake | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/util/util.cmake b/src/util/util.cmake index f05e5229..0efe4a32 100644 --- a/src/util/util.cmake +++ b/src/util/util.cmake @@ -69,13 +69,34 @@ set_target_properties(yaze_util PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ) -# Platform-specific compile definitions +# Ensure C++ standard is set (should be inherited from parent, but be explicit) +set_target_properties(yaze_util PROPERTIES + CXX_STANDARD 23 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF +) + +# Platform-specific compile definitions and libraries if(UNIX AND NOT APPLE) target_compile_definitions(yaze_util PRIVATE linux stricmp=strcasecmp) + # Link filesystem library for older GCC versions (< 9.0) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) + target_link_libraries(yaze_util PUBLIC stdc++fs) + endif() elseif(APPLE) target_compile_definitions(yaze_util PRIVATE MACOS) elseif(WIN32) target_compile_definitions(yaze_util PRIVATE WINDOWS) + # Windows-specific: Some clang-cl versions need help finding filesystem + # Ensure we're using the right C++ standard library headers + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Verify clang-cl can find MSVC STL headers with filesystem support + include(CheckIncludeFileCXX) + check_include_file_cxx("filesystem" HAVE_FILESYSTEM) + if(NOT HAVE_FILESYSTEM) + message(WARNING "std::filesystem not found - this may cause build failures on Windows") + endif() + endif() endif() message(STATUS "✓ yaze_util library configured")