Only search for yaml-cpp if asked to. (#3975)

This commit is contained in:
arcum42 2020-12-06 11:39:25 -08:00 committed by GitHub
parent 7bcee22890
commit 99b8168ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 7 deletions

View File

@ -206,6 +206,7 @@ for ARG in "$@"; do
--strip ) flags="$flags -DCMAKE_BUILD_STRIP=TRUE" ;;
--sdl12 ) flags="$flags -DSDL2_API=FALSE" ;;
--extra ) flags="$flags -DEXTRA_PLUGINS=TRUE" ;;
--use-system-yaml ) flags="$flags -DUSE_SYSTEM_YAML=TRUE" ;;
--asan ) flags="$flags -DUSE_ASAN=TRUE" ;;
--gtk2 ) flags="$flags -DGTK2_API=TRUE" ;;
--lto ) flags="$flags -DUSE_LTO=TRUE" ;;
@ -240,6 +241,7 @@ for ARG in "$@"; do
echo "** Distribution Compatibilities **"
echo "--sdl12 : Build with SDL1.2 (requires if wx is linked against SDL1.2)"
echo "--no-portaudio : Skip portaudio for spu2x."
echo "--use-system-yaml : Use the system version of yaml-cpp, if available."
echo
echo "** Expert Developer option **"
echo "--gtk2 : use GTK 2 instead of GTK 3"

View File

@ -22,6 +22,7 @@
#-------------------------------------------------------------------------------
option(DISABLE_BUILD_DATE "Disable including the binary compile date")
option(ENABLE_TESTS "Enables building the unit tests" ON)
option(USE_SYSTEM_YAML "Uses a system version of yaml, if found")
if(DISABLE_BUILD_DATE OR openSUSE)
message(STATUS "Disabling the inclusion of the binary compile date.")

View File

@ -269,15 +269,22 @@ else()
message(STATUS "Found fmt: ${fmt_VERSION}")
endif()
find_package(yaml-cpp "0.6.3" QUIET)
if(NOT yaml-cpp_FOUND)
if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/yaml-cpp/yaml-cpp/CMakeLists.txt")
message(STATUS "No system yaml-cpp was found. Using bundled")
add_subdirectory(3rdparty/yaml-cpp/yaml-cpp EXCLUDE_FROM_ALL)
if(USE_SYSTEM_YAML)
find_package(yaml-cpp "0.6.3" QUIET)
if(NOT yaml-cpp_FOUND)
message(STATUS "No system yaml-cpp was found")
set(USE_SYSTEM_YAML OFF)
else()
message(FATAL_ERROR "No system or bundled yaml-cpp was found")
endif()
else()
message(STATUS "Found yaml-cpp: ${yaml-cpp_VERSION}")
message(STATUS "Note that the latest release of yaml-cpp is very outdated, and the bundled submodule in the repo has over a year of bug fixes and as such is preferred.")
endif()
endif()
if(NOT USE_SYSTEM_YAML)
if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/yaml-cpp/yaml-cpp/CMakeLists.txt")
message(STATUS "Using bundled yaml-cpp")
add_subdirectory(3rdparty/yaml-cpp/yaml-cpp EXCLUDE_FROM_ALL)
else()
message(FATAL_ERROR "No bundled yaml-cpp was found")
endif()
endif()