Daeho Ro created AVRO-4171:
------------------------------

             Summary: Avro cpp build with system installed fmt
                 Key: AVRO-4171
                 URL: https://issues.apache.org/jira/browse/AVRO-4171
             Project: Apache Avro
          Issue Type: Improvement
          Components: c++
    Affects Versions: 1.12.0
         Environment: macos 15.5(24F74) with homebrew
            Reporter: Daeho Ro


We may use the system installed `fmt` not download for every build especially 
working with `homebrew`.

 Here is my suggestion.
 
{code:java}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19059a4..ba95df6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,15 +82,18 @@ endif ()
 find_package (Boost 1.38 REQUIRED
     COMPONENTS filesystem iostreams program_options regex system)
 
-include(FetchContent)
-FetchContent_Declare(
-        fmt
-        GIT_REPOSITORY  https://github.com/fmtlib/fmt.git
-        GIT_TAG         10.2.1
-        GIT_PROGRESS    TRUE
-        USES_TERMINAL_DOWNLOAD TRUE
-)
-FetchContent_MakeAvailable(fmt)
+find_package(fmt)
+if (NOT fmt_FOUND)
+    include(FetchContent)
+    FetchContent_Declare(
+            fmt
+            GIT_REPOSITORY  https://github.com/fmtlib/fmt.git
+            GIT_TAG         10.2.1
+            GIT_PROGRESS    TRUE
+            USES_TERMINAL_DOWNLOAD TRUE
+    )
+    FetchContent_MakeAvailable(fmt)
+endif (NOT fmt_FOUND)
 
 find_package(Snappy)
 if (SNAPPY_FOUND)
{code}
 

 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to