diff --git a/3rdparty/zstd/CMakeLists.txt b/3rdparty/zstd/CMakeLists.txt index 5a8b6f3d90..f4c97d3eeb 100644 --- a/3rdparty/zstd/CMakeLists.txt +++ b/3rdparty/zstd/CMakeLists.txt @@ -1,8 +1,16 @@ -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) +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 EXLUDE_FROM_ALL) -add_library(3rdparty_zstd INTERFACE) -target_link_libraries(3rdparty_zstd INTERFACE libzstd_static) + add_subdirectory(zstd/build/cmake EXLUDE_FROM_ALL) + add_library(3rdparty_zstd INTERFACE) + target_link_libraries(3rdparty_zstd INTERFACE libzstd_static) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 02cc27b7fc..1b132da0b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,7 @@ option(USE_SYSTEM_RTMIDI "Prefer system RtMidi instead of the builtin one" OFF) option(USE_SYSTEM_SDL "Prefer system SDL instead of the builtin one" ON) option(USE_SYSTEM_WOLFSSL "Prefer system MoltenVK instead of the builtin one" OFF) option(USE_SYSTEM_ZLIB "Prefer system ZLIB instead of the builtin one" ON) +option(USE_SYSTEM_ZSTD "Prefer system zstd instead of the builtin one" OFF) option(HAS_MEMORY_BREAKPOINTS "Add support for memory breakpoints to the interpreter" OFF) option(USE_LTO "Use LTO for building" ON) option(BUILD_RPCS3_TESTS "Build RPCS3 unit tests." OFF)