diff --git a/build.sh b/build.sh index cb012982cf..ad42602783 100755 --- a/build.sh +++ b/build.sh @@ -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" diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index a3ea1999e6..3ca4bdb700 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -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.") diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 5b6896a692..07ff6c2490 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -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(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(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 "No system yaml-cpp was found. Using bundled") + message(STATUS "Using bundled yaml-cpp") add_subdirectory(3rdparty/yaml-cpp/yaml-cpp EXCLUDE_FROM_ALL) else() - message(FATAL_ERROR "No system or bundled yaml-cpp was found") + message(FATAL_ERROR "No 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()