Default FindICU.cmake
is looking for include directory like:
find_path(ICU_INCLUDE_DIR
NAMES "unicode/utypes.h"
HINTS ${icu_roots}
PATH_SUFFIXES ${icu_include_suffixes}
DOC "ICU include directory")
icu_roots
is built from ICU_ROOT
:
list(APPEND icu_roots "${ICU_ROOT}")
icu_include_suffixes
is always include
:
list(APPEND icu_include_suffixes "include")
The problem appears when ICU_ROOT
is set to /usr/local/opt/icu4c
(homebrew location on macOS) because eventually the include directory(and just include) is wrong:
-- Found the following ICU libraries:
-- uc (required): /usr/local/opt/icu4c/lib/libicuuc.dylib
-- i18n (required): /usr/local/opt/icu4c/lib/libicui18n.dylib
-- --------FindICU.cmake search debug--------
-- ICU binary path search order: /usr/local/opt/icu4c
-- ICU include path search order: /usr/local/opt/icu4c
-- ICU library path search order: /usr/local/opt/icu4c
-- ----------------
-- --------FindICU.cmake results debug--------
-- ICU found: TRUE
-- ICU_VERSION number: 70.1
-- ICU_ROOT directory: /usr/local/opt/icu4c
-- ICU_INCLUDE_DIR directory: /Applications/Xcode14.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include
-- ICU_LIBRARIES: /usr/local/opt/icu4c/lib/libicuuc.dylib;/usr/local/opt/icu4c/lib/libicui18n.dylib
-- gencnval program: ICU_GENCNVAL_EXECUTABLE=/usr/local/opt/icu4c/bin/gencnval
-- icuinfo program: ICU_ICUINFO_EXECUTABLE=/usr/local/opt/icu4c/bin/icuinfo
-- genbrk program: ICU_GENBRK_EXECUTABLE=/usr/local/opt/icu4c/bin/genbrk
-- icu-config program: ICU_ICU-CONFIG_EXECUTABLE=/usr/local/opt/icu4c/bin/icu-config
-- genrb program: ICU_GENRB_EXECUTABLE=/usr/local/opt/icu4c/bin/genrb
-- gendict program: ICU_GENDICT_EXECUTABLE=/usr/local/opt/icu4c/bin/gendict
-- derb program: ICU_DERB_EXECUTABLE=/usr/local/opt/icu4c/bin/derb
-- pkgdata program: ICU_PKGDATA_EXECUTABLE=/usr/local/opt/icu4c/bin/pkgdata
-- uconv program: ICU_UCONV_EXECUTABLE=/usr/local/opt/icu4c/bin/uconv
-- gencfu program: ICU_GENCFU_EXECUTABLE=/usr/local/opt/icu4c/bin/gencfu
-- makeconv program: ICU_MAKECONV_EXECUTABLE=/usr/local/opt/icu4c/bin/makeconv
-- gennorm2 program: ICU_GENNORM2_EXECUTABLE=/usr/local/opt/icu4c/sbin/gennorm2
-- genccode program: ICU_GENCCODE_EXECUTABLE=/usr/local/opt/icu4c/sbin/genccode
-- gensprep program: ICU_GENSPREP_EXECUTABLE=/usr/local/opt/icu4c/sbin/gensprep
-- icupkg program: ICU_ICUPKG_EXECUTABLE=/usr/local/opt/icu4c/sbin/icupkg
-- gencmn program: ICU_GENCMN_EXECUTABLE=/usr/local/opt/icu4c/sbin/gencmn
-- Makefile.inc data: ICU_MAKEFILE_INC=/usr/local/opt/icu4c/lib/icu/Makefile.inc
-- pkgdata.inc data: ICU_PKGDATA_INC=/usr/local/opt/icu4c/lib/icu/pkgdata.inc
-- uc library found: ICU_UC_FOUND=ON
-- uc library found (compat name): UC_FOUND=ON
-- uc library: ICU_UC_LIBRARIES=/usr/local/opt/icu4c/lib/libicuuc.dylib
-- i18n library found: ICU_I18N_FOUND=ON
-- i18n library found (compat name): I18N_FOUND=ON
-- i18n library: ICU_I18N_LIBRARIES=/usr/local/opt/icu4c/lib/libicui18n.dylib
-- ----------------
I tried several CMake versions and different options with find_package()
like:
- NO_CACHE
- NO_DEFAULT_PATH
- NO_CMAKE_SYSTEM_PATH
- NO_PACKAGE_ROOT_PATH
- NO_CMAKE_PATH
- NO_CMAKE_ENVIRONMENT_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH
- NO_CMAKE_FIND_ROOT_PATH
...but no luck.
I know a workaround but would like to find out the reason and patch.