From 999e42118cb80c8ba77b1979f2eb2eccc792773e Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 17 Jan 2022 13:10:57 -0800 Subject: [PATCH] build: allow static linking against ICU data With the removal of the ICU data dependency in swiftCore, it is now possible to statically link to the ICU, with static linking to the ICU data as well. This would allow us to remove the ICU dependency from leaking into distributions which was previously required due to the oversized cost of the ICU data. With the single use now, it is possible to statically link the data to avoid the distribution and packaging. In order to provide a migration path, this needs to be optionalised, and as such, we only link the data if it is found (and can be controlled through `-D ICU_DATA_LIBRARY_RELEASE=` --- CMakeLists.txt | 2 +- CoreFoundation/CMakeLists.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51826131e6..bbc945365f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,7 @@ if(HAS_LIBDISPATCH_API) find_package(dispatch CONFIG REQUIRED) endif() -find_package(ICU COMPONENTS uc i18n REQUIRED) +find_package(ICU COMPONENTS uc i18n REQUIRED OPTIONAL_COMPONENTS data) include(SwiftSupport) include(GNUInstallDirs) diff --git a/CoreFoundation/CMakeLists.txt b/CoreFoundation/CMakeLists.txt index 9871290d09..afd005e4cc 100644 --- a/CoreFoundation/CMakeLists.txt +++ b/CoreFoundation/CMakeLists.txt @@ -397,6 +397,10 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) target_link_libraries(CoreFoundation PRIVATE ICU::uc ICU::i18n) + if(ICU_DATA_FOUND) + target_link_libraries(CoreFoundation PRIVATE + ICU::data) + endif() endif() if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)