Skip to content

Commit 52714f7

Browse files
lemireanonrig
authored andcommitted
fix: look for ICU.
1 parent 1d24ce9 commit 52714f7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

benchmarks/CMakeLists.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,39 @@ target_link_libraries(percent_encode PRIVATE benchmark::benchmark)
4848

4949
option(ADA_COMPETITION "Whether to install various competitors." OFF)
5050

51+
# We only build url_whatwg if ICU is found, so we need to make
52+
# finding ICU easy.
53+
54+
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
55+
message(STATUS "Apple system detected.")
56+
# People who run macOS often use brew.
57+
if(EXISTS /opt/homebrew/opt/icu4c)
58+
message(STATUS "icu is provided by homebrew at /opt/homebrew/opt/icu4c.")
59+
## This is a bit awkward, but it is a lot better than asking the
60+
## user to figure that out.
61+
list(APPEND CMAKE_PREFIX_PATH "/opt/homebrew/opt/icu4c/include")
62+
list(APPEND CMAKE_LIBRARY_PATH "/opt/homebrew/opt/icu4c/lib")
63+
elseif(EXISTS /usr/local/opt/icu4c)
64+
message(STATUS "icu is provided by homebrew at /usr/local/opt/icu4c.")
65+
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/icu4c/include")
66+
list(APPEND CMAKE_LIBRARY_PATH "/usr/local/opt/icu4c/lib")
67+
endif()
68+
endif()
69+
70+
find_package(ICU COMPONENTS uc i18n)
71+
### If the user does not have ICU, let us help them with instructions:
72+
if(NOT ICU_FOUND)
73+
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
74+
if(EXISTS /opt/homebrew)
75+
message(STATUS "Under macOS, you may install ICU with brew, using 'brew install icu4c'.")
76+
else()
77+
message(STATUS "Under macOS, you should install brew (see https://brew.sh) and then icu4c ('brew install icu4c').")
78+
endif()
79+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
80+
message(STATUS "Under Linux, you may be able to install ICU with a command such as 'apt-get install libicu-dev'." )
81+
endif()
82+
endif(NOT ICU_FOUND)
83+
5184
if(ICU_FOUND)
5285
set_off(URL_BUILD_TESTS)
5386
set_off(URL_USE_LIBS)

0 commit comments

Comments
 (0)