File tree 3 files changed +15
-2
lines changed
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ if(HAS_LIBDISPATCH_API)
47
47
find_package (dispatch CONFIG REQUIRED)
48
48
endif ()
49
49
50
+ find_package (ICU COMPONENTS uc i18n REQUIRED)
51
+
50
52
include (SwiftSupport)
51
53
include (GNUInstallDirs)
52
54
include (XCTest)
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
32
32
else ()
33
33
find_package (CURL REQUIRED)
34
34
endif ()
35
- find_package (ICU COMPONENTS uc i18n REQUIRED)
36
35
endif ()
37
36
38
37
include (GNUInstallDirs)
Original file line number Diff line number Diff line change @@ -161,10 +161,22 @@ set_target_properties(Foundation PROPERTIES
161
161
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR} /swift)
162
162
163
163
if (NOT BUILD_SHARED_LIBS )
164
+ # ICU_I18N_LIBRARY is set by find_package(ICU) in the top level CMakeLists.txt
165
+ # It's an absolute path to the found library file
166
+ get_target_property (icui18n_path ICU::i18n IMPORTED_LOCATION )
167
+ get_filename_component (icu_i18n_basename "${icui18n_path} " NAME_WE )
168
+ get_filename_component (icu_i18n_dir "${icui18n_path} " DIRECTORY )
169
+ string (REPLACE "lib" "" icu_i18n_basename "${icu_i18n_basename} " )
170
+
164
171
target_compile_options (Foundation
165
172
PRIVATE
166
- "SHELL:-Xfrontend -public-autolink-library -Xfrontend icui18n
173
+ "SHELL:-Xfrontend -public-autolink-library -Xfrontend ${icu_i18n_basename}
167
174
-Xfrontend -public-autolink-library -Xfrontend BlocksRuntime" )
175
+ # ICU libraries are linked by absolute library path in this project,
176
+ # but -public-autolink-library forces to resolve library path by
177
+ # library search path given by -L, so add a directory of icui18n
178
+ # in the search path
179
+ target_link_directories (Foundation PUBLIC "${icu_i18n_dir} " )
168
180
169
181
# Merge private dependencies into single static objects archive
170
182
set_property (TARGET Foundation PROPERTY STATIC_LIBRARY_OPTIONS
You can’t perform that action at this time.
0 commit comments