From 916f1ad5b391764e964b271f80b915869e1afed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 5 Aug 2022 19:44:40 +0200 Subject: [PATCH] Error if homebrew ICU is in LDFLAGS on iOS/tvOS (#73467) Fixes https://github.com/dotnet/runtime/issues/50365 --- src/mono/CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 79f4f677c994c..dc4ff5b188648 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -664,14 +664,21 @@ endif() ###################################### # ICU CHECKS ###################################### +if(HOST_OSX OR HOST_MACCAT OR HOST_IOS OR HOST_TVOS) + # FIXME: Handle errors + execute_process(COMMAND brew --prefix OUTPUT_VARIABLE brew_prefix OUTPUT_STRIP_TRAILING_WHITESPACE) + + if((HOST_MACCAT OR HOST_IOS OR HOST_TVOS) AND "${CMAKE_SHARED_LINKER_FLAGS}" MATCHES "${brew_prefix}/opt/icu4c/lib") + message(FATAL_ERROR "Linker flags contain the Homebrew version of ICU which conflicts with the iOS/tvOS/MacCatalyst version: ${CMAKE_SHARED_LINKER_FLAGS}") + endif() +endif() + set(ICU_SHIM_PATH "${CLR_SRC_NATIVE_DIR}/libs/System.Globalization.Native") if(MONO_CROSS_COMPILE) elseif(HOST_OSX AND NOT HOST_MACCAT) include(FindPkgConfig) - # FIXME: Handle errors - # Defines ICU_INCLUDEDIR/ICU_LIBDIR - execute_process(COMMAND brew --prefix OUTPUT_VARIABLE brew_prefix OUTPUT_STRIP_TRAILING_WHITESPACE) set(ENV{PKG_CONFIG_PATH} "{$PKG_CONFIG_PATH}:${brew_prefix}/lib/pkgconfig:${brew_prefix}/opt/icu4c/lib/pkgconfig") + # Defines ICU_INCLUDEDIR/ICU_LIBDIR pkg_check_modules(ICU icu-uc) set(OSX_ICU_LIBRARY_PATH /usr/lib/libicucore.dylib) set(ICU_FLAGS "-DTARGET_UNIX -DU_DISABLE_RENAMING -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option -Wno-deprecated-declarations")