diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fc0e7d..689b922 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ include(GNUInstallDirs) # This helps to build vendor projects with or without any patching. Also if any # files are changed in vendor projects those can be retained with this option. option(ANDROID_TOOLS_PATCH_VENDOR "Patch vendor projects using patches directory" ON) +option(ANDROID_TOOLS_USE_SYSTEM_FMT "Use system provided fmt library instead of bundled one" OFF) # Install bash/zsh completion files. set(COMPLETION_COMMON_DIR "${CMAKE_INSTALL_FULL_DATADIR}/android-tools/completions") diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt index 2348845..864cfe9 100644 --- a/vendor/CMakeLists.txt +++ b/vendor/CMakeLists.txt @@ -75,7 +75,13 @@ if(ANDROID_TOOLS_PATCH_VENDOR AND EXISTS "${ANDROID_PATCH_DIR}/") endif() add_subdirectory(boringssl EXCLUDE_FROM_ALL) -add_subdirectory(fmtlib EXCLUDE_FROM_ALL) + +if(ANDROID_TOOLS_USE_SYSTEM_FMT) + find_package(fmt CONFIG REQUIRED) + message(STATUS "Found fmt: ${fmt_DIR} (version ${fmt_VERSION})") +else() + add_subdirectory(fmtlib EXCLUDE_FROM_ALL) +endif() find_package(PkgConfig REQUIRED) pkg_check_modules(libbrotlicommon REQUIRED IMPORTED_TARGET libbrotlicommon)