You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "daeho-ro (via GitHub)" <gi...@apache.org> on 2025/08/02 03:44:45 UTC

[PR] AVRO-4171: [c++] find system installed fmt first [avro]

daeho-ro opened a new pull request, #3447:
URL: https://github.com/apache/avro/pull/3447

   ## What is the purpose of the change
   
   This pull request find system installed `fmt` package first and then try the original `fetch_content` to download it from upstream. Other packages are looking for it from the system but `fmt` is not yet.
   
   ## Verifying this change
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   ## Documentation
   
   - Does this pull request introduce a new feature? (no)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] AVRO-4171: [c++] find system installed fmt first [avro]

Posted by "KalleOlaviNiemitalo (via GitHub)" <gi...@apache.org>.
KalleOlaviNiemitalo commented on code in PR #3447:
URL: https://github.com/apache/avro/pull/3447#discussion_r2249153168


##########
lang/c++/CMakeLists.txt:
##########
@@ -79,15 +79,18 @@ if (AVRO_BUILD_TESTS OR AVRO_USE_BOOST)
     find_package (Boost 1.70 REQUIRED CONFIG COMPONENTS system)
 endif ()
 
-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)

Review Comment:
   Most other `endif` lines in this file don't repeat the condition.  According to <https://cmake.org/cmake/help/v3.14/command/if.html> and <https://cmake.org/cmake/help/v3.14/command/endif.html>, repeating the condition has been "legacy" and "supported for backward compatibility only" since CMake 3.14, and was already optional in CMake 3.0.
   
   However, two other `endif` lines in this file do repeat the condition, so the style is already inconsistent.
   
   It's not important to me what you choose here, but it caught my eye and I was curious about CMake best practices.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] AVRO-4171: [c++] find system installed fmt first [avro]

Posted by "daeho-ro (via GitHub)" <gi...@apache.org>.
daeho-ro commented on code in PR #3447:
URL: https://github.com/apache/avro/pull/3447#discussion_r2249214243


##########
lang/c++/CMakeLists.txt:
##########
@@ -79,15 +79,18 @@ if (AVRO_BUILD_TESTS OR AVRO_USE_BOOST)
     find_package (Boost 1.70 REQUIRED CONFIG COMPONENTS system)
 endif ()
 
-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)

Review Comment:
   I have followed the style from snappy one with version 1.12.0 but it seems now modified. That is a good catch, I will remove.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] AVRO-4171: [c++] find system installed fmt first [avro]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on code in PR #3447:
URL: https://github.com/apache/avro/pull/3447#discussion_r2252472643


##########
lang/c++/CMakeLists.txt:
##########
@@ -79,15 +79,18 @@ if (AVRO_BUILD_TESTS OR AVRO_USE_BOOST)
     find_package (Boost 1.70 REQUIRED CONFIG COMPONENTS system)
 endif ()
 
-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)

Review Comment:
   Do you have any data about the adoption of 20/23 in the wild ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] AVRO-4171: [c++] find system installed fmt first [avro]

Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #3447:
URL: https://github.com/apache/avro/pull/3447#discussion_r2251889307


##########
lang/c++/CMakeLists.txt:
##########
@@ -79,15 +79,18 @@ if (AVRO_BUILD_TESTS OR AVRO_USE_BOOST)
     find_package (Boost 1.70 REQUIRED CONFIG COMPONENTS system)
 endif ()
 
-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)

Review Comment:
   Not related to this PR: any plan to switch to C++20/23 so we can leverage std::format?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] AVRO-4171: [c++] find system installed fmt first [avro]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g merged PR #3447:
URL: https://github.com/apache/avro/pull/3447


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] AVRO-4171: [c++] find system installed fmt first [avro]

Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #3447:
URL: https://github.com/apache/avro/pull/3447#discussion_r2252914999


##########
lang/c++/CMakeLists.txt:
##########
@@ -79,15 +79,18 @@ if (AVRO_BUILD_TESTS OR AVRO_USE_BOOST)
     find_package (Boost 1.70 REQUIRED CONFIG COMPONENTS system)
 endif ()
 
-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)

Review Comment:
   As far as the projects that I have involved:
   - Apache Arrow is still on C++17 but is trying to support both C++20 and C++23: https://github.com/apache/arrow/issues/47207
   - Apache Iceberg C++ (which depends on Avro C++) is on C++23 now: https://github.com/apache/iceberg-cpp/blob/main/CMakeLists.txt#L31



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] AVRO-4171: [c++] find system installed fmt first [avro]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on PR #3447:
URL: https://github.com/apache/avro/pull/3447#issuecomment-3149215661

   @wgtmac @mkmkme ^^


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org