From a8d49306e566c574bd8d335b14a87d0df88c9831 Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 11 Oct 2025 03:52:20 -0400 Subject: [PATCH] chore(cmake): update .gitignore and enhance CMake configuration - Added new entries to .gitignore to exclude generated files and directories, improving project cleanliness. - Set minimum policy version for subdirectories in CMake to ensure compatibility with older dependencies like yaml-cpp, enhancing build reliability. Benefits: - Streamlined project structure by ignoring unnecessary files. - Improved compatibility and maintainability of the CMake configuration. --- .gitignore | 6 ++++-- CMakeLists.txt | 4 ++++ cmake/dependencies.cmake | 19 ++----------------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 2395334b..93c7b9b1 100644 --- a/.gitignore +++ b/.gitignore @@ -86,8 +86,10 @@ src/app/emu/cpu/internal/old_cpu.cc .favorites.json checks.json assets/etc/ -*.sfc imgui.ini .gitignore recent_files.txt -.vs/* \ No newline at end of file +.vs/* +.gitignore +.genkit +.claude \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 5839ea3a..db7af05f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,10 @@ # by scawful cmake_minimum_required(VERSION 3.16) +# Set minimum policy version for subdirectories to allow older dependencies like yaml-cpp +# This allows cmake_minimum_required in subdirectories to use versions < 3.5 +set(CMAKE_POLICY_VERSION_MINIMUM 3.5 CACHE STRING "Minimum policy version for subdirectories") + # Set policies for compatibility cmake_policy(SET CMP0091 NEW) cmake_policy(SET CMP0048 NEW) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index da6006b4..1ab960e9 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -101,27 +101,12 @@ set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "Disable yaml-cpp tools" FORCE) set(YAML_CPP_INSTALL OFF CACHE BOOL "Disable yaml-cpp install" FORCE) set(YAML_CPP_FORMAT_SOURCE OFF CACHE BOOL "Disable yaml-cpp format target" FORCE) -# Use yaml-cpp 0.8.0 with inline patch for CMake 3.31+ compatibility -# yaml-cpp 0.8.0 requires CMake 2.8.12 which is incompatible with CMake 3.31+ +# yaml-cpp (uses CMAKE_POLICY_VERSION_MINIMUM set in root CMakeLists.txt) FetchContent_Declare(yaml-cpp GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git GIT_TAG 0.8.0 ) - -# Manually populate and patch to avoid cmake_minimum_required compatibility issue -FetchContent_GetProperties(yaml-cpp) -if(NOT yaml-cpp_POPULATED) - FetchContent_Populate(yaml-cpp) - - # Patch CMakeLists.txt to use CMake 3.5 minimum (compatible with 3.31+) - file(READ "${yaml-cpp_SOURCE_DIR}/CMakeLists.txt" YAML_CMAKE_CONTENT) - string(REPLACE "cmake_minimum_required(VERSION 2.8.12)" - "cmake_minimum_required(VERSION 3.5)" - YAML_CMAKE_CONTENT "${YAML_CMAKE_CONTENT}") - file(WRITE "${yaml-cpp_SOURCE_DIR}/CMakeLists.txt" "${YAML_CMAKE_CONTENT}") - - add_subdirectory(${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR}) -endif() +FetchContent_MakeAvailable(yaml-cpp) # nlohmann_json (header only) if(YAZE_WITH_JSON)