kou commented on code in PR #49370:
URL: https://github.com/apache/arrow/pull/49370#discussion_r2843894818
##########
cpp/cmake_modules/BuildUtils.cmake:
##########
@@ -91,28 +91,59 @@ function(arrow_create_merged_static_lib output_target)
endforeach()
if(APPLE)
+ # Get the version string from a libtool binary.
+ function(get_libtool_version item result_var)
+ execute_process(COMMAND "${item}" -V
+ OUTPUT_VARIABLE _version
+ OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
+ set(${result_var}
+ "${_version}"
+ PARENT_SCOPE)
+ endfunction()
+
+ # Validator function to confirm that the libtool is Apple's libtool.
+ # The apple-distributed libtool is what we want for bundling, but there is
+ # a GNU libtool that has a name collision (and happens to be bundled with
R, too).
+ # We are not compatible with GNU libtool, so we need to avoid it.
+ function(validate_apple_libtool result_var item)
+ get_libtool_version("${item}" libtool_version)
+ if("${libtool_version}" MATCHES ".*cctools.+([0-9.]+).*")
+ set(${result_var}
+ TRUE
+ PARENT_SCOPE)
+ else()
+ set(${result_var}
+ FALSE
+ PARENT_SCOPE)
+ endif()
+ endfunction()
Review Comment:
It seems that we need to set only when the given `item` is invalid:
```suggestion
if(NOT "${libtool_version}" MATCHES ".*cctools.+([0-9.]+).*")
set(${result_var}
FALSE
PARENT_SCOPE)
endif()
endfunction()
```
https://cmake.org/cmake/help/latest/command/find_program.html
> The result variable will hold a true value when the validator function is
entered.
>
> ```cmake
> function(my_check validator_result_var item)
> if(NOT item MATCHES ...)
> set(${validator_result_var} FALSE PARENT_SCOPE)
> endif()
> endfunction()
> ```
--
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]