diff --git a/CMakeLists.txt b/CMakeLists.txt index a2261730b5..2cc8594f1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -800,7 +800,15 @@ else() set(LZO lzo2) endif() -add_subdirectory(Externals/libspng) +pkg_check_modules(pc_spng IMPORTED_TARGET spng) +if (pc_spng_FOUND AND TARGET PkgConfig::pc_spng) + message(STATUS "Using the system libspng") + set(spng_target PkgConfig::pc_spng) +else() + message(STATUS "Using static libspng from Externals") + add_subdirectory(Externals/libspng) + set(spng_target spng) +endif() # Using static FreeSurround from Externals # There is no system FreeSurround library. diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index 30248f864f..1177363ec3 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -157,7 +157,7 @@ PRIVATE ${CURL_LIBRARIES} FatFs ${ICONV_LIBRARIES} - spng + ${spng_target} ${VTUNE_LIBRARIES} ) diff --git a/Source/Core/InputCommon/CMakeLists.txt b/Source/Core/InputCommon/CMakeLists.txt index 20ae0f3f17..4b2ab2a170 100644 --- a/Source/Core/InputCommon/CMakeLists.txt +++ b/Source/Core/InputCommon/CMakeLists.txt @@ -81,7 +81,7 @@ PUBLIC PRIVATE fmt::fmt - spng + ${spng_target} ) if(WIN32) diff --git a/Source/Core/VideoCommon/CMakeLists.txt b/Source/Core/VideoCommon/CMakeLists.txt index 392e53df91..036a5c2c24 100644 --- a/Source/Core/VideoCommon/CMakeLists.txt +++ b/Source/Core/VideoCommon/CMakeLists.txt @@ -183,7 +183,7 @@ PUBLIC core PRIVATE fmt::fmt - spng + ${spng_target} xxhash imgui implot