CMake: Don't use system rapidyaml in default builds

This commit is contained in:
TellowKrinkle 2023-06-06 02:32:16 -05:00 committed by refractionpcsx2
parent d1ed5aadc2
commit 260846e9e9
2 changed files with 12 additions and 2 deletions

View File

@ -7,6 +7,7 @@ set(PCSX2_DEFS "")
option(DISABLE_BUILD_DATE "Disable including the binary compile date")
option(ENABLE_TESTS "Enables building the unit tests" ON)
set(USE_SYSTEM_LIBS "AUTO" CACHE STRING "Use system libraries instead of bundled libraries. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled. Default is AUTO")
set(DEFAULT_USE_SYSTEM_RYML OFF) # System rapidyaml causes a lot of problems
optional_system_library(fmt)
optional_system_library(ryml)
optional_system_library(zstd)

View File

@ -199,9 +199,18 @@ endfunction()
function(optional_system_library library)
string(TOUPPER ${library} upperlib)
set(USE_SYSTEM_${upperlib} "" CACHE STRING "Use system ${library} instead of bundled. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled, blank - Delegate to USE_SYSTEM_LIBS. Default is blank.")
if (DEFINED DEFAULT_USE_SYSTEM_${upperlib})
set(extra " with extra override to ${DEFAULT_USE_SYSTEM_${upperlib}} on fully default builds")
else()
set(extra)
endif()
set(USE_SYSTEM_${upperlib} "" CACHE STRING "Use system ${library} instead of bundled. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled, blank - Delegate to USE_SYSTEM_LIBS${extra}. Default is blank.")
if ("${USE_SYSTEM_${upperlib}}" STREQUAL "")
set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_LIBS} PARENT_SCOPE)
if(${USE_SYSTEM_LIBS} STREQUAL "AUTO" AND DEFINED DEFAULT_USE_SYSTEM_${upperlib})
set(RESOLVED_USE_SYSTEM_${upperlib} ${DEFAULT_USE_SYSTEM_${upperlib}} PARENT_SCOPE)
else()
set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_LIBS} PARENT_SCOPE)
endif()
else()
set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_${upperlib}} PARENT_SCOPE)
endif()