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.
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -86,8 +86,10 @@ src/app/emu/cpu/internal/old_cpu.cc
|
|||||||
.favorites.json
|
.favorites.json
|
||||||
checks.json
|
checks.json
|
||||||
assets/etc/
|
assets/etc/
|
||||||
*.sfc
|
|
||||||
imgui.ini
|
imgui.ini
|
||||||
.gitignore
|
.gitignore
|
||||||
recent_files.txt
|
recent_files.txt
|
||||||
.vs/*
|
.vs/*
|
||||||
|
.gitignore
|
||||||
|
.genkit
|
||||||
|
.claude
|
||||||
@@ -2,6 +2,10 @@
|
|||||||
# by scawful
|
# by scawful
|
||||||
cmake_minimum_required(VERSION 3.16)
|
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
|
# Set policies for compatibility
|
||||||
cmake_policy(SET CMP0091 NEW)
|
cmake_policy(SET CMP0091 NEW)
|
||||||
cmake_policy(SET CMP0048 NEW)
|
cmake_policy(SET CMP0048 NEW)
|
||||||
|
|||||||
@@ -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_INSTALL OFF CACHE BOOL "Disable yaml-cpp install" FORCE)
|
||||||
set(YAML_CPP_FORMAT_SOURCE OFF CACHE BOOL "Disable yaml-cpp format target" 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 (uses CMAKE_POLICY_VERSION_MINIMUM set in root CMakeLists.txt)
|
||||||
# yaml-cpp 0.8.0 requires CMake 2.8.12 which is incompatible with CMake 3.31+
|
|
||||||
FetchContent_Declare(yaml-cpp
|
FetchContent_Declare(yaml-cpp
|
||||||
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
|
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
|
||||||
GIT_TAG 0.8.0
|
GIT_TAG 0.8.0
|
||||||
)
|
)
|
||||||
|
FetchContent_MakeAvailable(yaml-cpp)
|
||||||
# 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()
|
|
||||||
|
|
||||||
# nlohmann_json (header only)
|
# nlohmann_json (header only)
|
||||||
if(YAZE_WITH_JSON)
|
if(YAZE_WITH_JSON)
|
||||||
|
|||||||
Reference in New Issue
Block a user