From 6c7bcd7ccc24734c8e2d18029bc47fb1a24f5722 Mon Sep 17 00:00:00 2001 From: Jialiang Tan Date: Fri, 1 Nov 2024 16:43:02 -0700 Subject: [PATCH] Avoid hard coded icu4c path (#11410) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/11410 Reviewed By: xiaoxmeng, kgpai Differential Revision: D65354548 Pulled By: tanjialiang fbshipit-source-id: bd6d4880198bee7162adf84b9e0ee8f8b1dd605d --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 168eee277044..6a7744d94ae1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -387,7 +387,18 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) if(CMAKE_SYSTEM_NAME MATCHES "Darwin") if(ON_APPLE_M1) - list(APPEND CMAKE_PREFIX_PATH "/opt/homebrew/opt/icu4c") + execute_process( + COMMAND brew --prefix icu4c + RESULT_VARIABLE BREW_ICU4C + OUTPUT_VARIABLE BREW_ICU4C_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(BREW_ICU4C EQUAL 0 AND EXISTS "${BREW_ICU4C_PREFIX}") + message( + STATUS "Found icu4c installed by Homebrew at ${BREW_ICU4C_PREFIX}") + list(APPEND CMAKE_PREFIX_PATH "${BREW_ICU4C_PREFIX}") + else() + list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/icu4c") + endif() else() list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/icu4c") endif()