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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]