if(USE_SYSTEM_ZSTD)
  message(STATUS "RPCS3: using shared zstd")
  pkg_check_modules(zstd REQUIRED IMPORTED_TARGET libzstd)
  add_library(3rdparty_zstd INTERFACE)
  target_link_libraries(3rdparty_zstd INTERFACE PkgConfig::zstd)
  target_include_directories(3rdparty_zstd INTERFACE PkgConfig::RtMidi)
else()
  option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" OFF)
  option(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" OFF)
  option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON)
  option(ZSTD_BUILD_TESTS "BUILD TESTS" OFF)

  add_subdirectory(zstd/build/cmake EXCLUDE_FROM_ALL)
  add_library(3rdparty_zstd INTERFACE)
  target_link_libraries(3rdparty_zstd INTERFACE libzstd_static)
endif()
