kou commented on code in PR #43219:
URL: https://github.com/apache/arrow/pull/43219#discussion_r1674678321


##########
cpp/cmake_modules/ThirdpartyToolchain.cmake:
##########
@@ -249,6 +249,23 @@ function(provide_find_module PACKAGE_NAME 
ARROW_CMAKE_PACKAGE_NAME)
   provide_cmake_module("Find${PACKAGE_NAME}" ${ARROW_CMAKE_PACKAGE_NAME})
 endfunction()
 
+# Compare the version numbers of a package. Must call after a find_package()
+# call because version of package is accessed by ${${PACKAGE_NAME}_VERSION}.
+#
+# COMPATIBLE_VAR is set to the boolean value of
+# ${${PACKAGE_NAME}_VERSION} >= ${REQUIRED_VERSION}.
+function(compare_version PACKAGE_NAME REQUIRED_VERSION COMPATIBLE_VAR)
+  if(${${PACKAGE_NAME}_VERSION} VERSION_LESS ${REQUIRED_VERSION})
+    set(${COMPATIBLE_VAR}
+        FALSE
+        PARENT_SCOPE)
+  else()
+    set(${COMPATIBLE_VAR}
+        TRUE
+        PARENT_SCOPE)
+  endif()
+endfunction()

Review Comment:
   Hmm. I don't think that we need to extract this because:
   
   * This doesn't improve readability. It gets a little more complicated 
instead.
      * The original code is enough simple. It's just `if(XXX VERSION_LESS 
YYY)`.
   * We will not reuse this code in other codes.
   
   Why do you want to extract this?
   
   If you want to extract this, could you add `arrow_` prefix?



-- 
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]

Reply via email to