This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new d0d25bb  ARROW-3518: Detect HOMEBREW_PREFIX automatically
d0d25bb is described below

commit d0d25bb421d35e70096cb1a6bfe672a7f720b8a2
Author: Kenta Murata <[email protected]>
AuthorDate: Mon Oct 15 09:57:20 2018 -0400

    ARROW-3518: Detect HOMEBREW_PREFIX automatically
    
    It can be detected by executing `brew --prefix` if available.
    
    Author: Kenta Murata <[email protected]>
    
    Closes #2761 from mrkn/use_brew_prefix and squashes the following commits:
    
    1863b4e28 <Kenta Murata> Detect HOMEBREW_PREFIX automatically
---
 cpp/cmake_modules/FindClangTools.cmake | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/cpp/cmake_modules/FindClangTools.cmake 
b/cpp/cmake_modules/FindClangTools.cmake
index f20ee88..2ddf788 100644
--- a/cpp/cmake_modules/FindClangTools.cmake
+++ b/cpp/cmake_modules/FindClangTools.cmake
@@ -28,12 +28,21 @@
 #  CLANG_TIDY_BIN, The  path to the clang tidy binary
 #  CLANG_TIDY_FOUND, Whether clang tidy was found
 #  CLANG_FORMAT_BIN, The path to the clang format binary
-#  CLANG_TIDY_FOUND, Whether clang format was found
+#  CLANG_FORMAT_FOUND, Whether clang format was found
 
 if (DEFINED ENV{HOMEBREW_PREFIX})
   set(HOMEBREW_PREFIX "$ENV{HOMEBREW_PREFIX}")
 else()
-  set(HOMEBREW_PREFIX "/usr/local")
+  find_program(BREW_BIN brew)
+  if ((NOT ("${BREW_BIN}" STREQUAL "BREW_BIN-NOTFOUND")) AND APPLE)
+    execute_process(
+      COMMAND ${BREW_BIN} --prefix
+      OUTPUT_VARIABLE HOMEBREW_PREFIX
+      OUTPUT_STRIP_TRAILING_WHITESPACE
+    )
+  else()
+    set(HOMEBREW_PREFIX "/usr/local")
+  endif()
 endif()
 
 find_program(CLANG_TIDY_BIN

Reply via email to