Skip to content

Commit 9cea66b

Browse files
committed
[cmake] FindICU finds static libraries as well.
As suggested in #32736, it would be ideal to use the FindICU generated variables to refer to the ICU library paths. However, as it stands, this only finds the dynamic libraries, so here we find the static libraries as well.
1 parent af31e09 commit 9cea66b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

cmake/modules/FindICU.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ foreach(MODULE ${ICU_FIND_COMPONENTS})
2222
HINTS ${PC_ICU_${MODULE}_INCLUDE_DIRS})
2323
find_library(ICU_${MODULE}_LIBRARIES NAMES icu${module} ${ICU_${MODULE}_LIB_NAME}
2424
HINTS ${PC_ICU_${MODULE}_LIBRARY_DIRS})
25+
find_library(ICU_${MODULE}_LIBRARIES_STATIC NAMES libicu${module}.a ${ICU_${MODULE}_LIB_NAME}
26+
HINTS ${PC_ICU_${MODULE}_LIBRARY_DIRS})
2527
endforeach()
2628

2729
foreach(sdk ANDROID;FREEBSD;OPENBSD;LINUX;WINDOWS;HAIKU)
@@ -33,6 +35,9 @@ foreach(sdk ANDROID;FREEBSD;OPENBSD;LINUX;WINDOWS;HAIKU)
3335
if("${SWIFT_${sdk}_${SWIFT_HOST_VARIANT_ARCH}_ICU_${MODULE}}" STREQUAL "")
3436
set(SWIFT_${sdk}_${SWIFT_HOST_VARIANT_ARCH}_ICU_${MODULE} ${ICU_${MODULE}_LIBRARIES} CACHE STRING "" FORCE)
3537
endif()
38+
if("${SWIFT_${sdk}_${SWIFT_HOST_VARIANT_ARCH}_ICU_${MODULE}_STATIC}" STREQUAL "")
39+
set(SWIFT_${sdk}_${SWIFT_HOST_VARIANT_ARCH}_ICU_${MODULE}_STATIC ${ICU_${MODULE}_LIBRARIES_STATIC} CACHE STRING "" FORCE)
40+
endif()
3641
endforeach()
3742
endforeach()
3843

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ function(_report_sdk prefix)
7676
foreach(arch ${SWIFT_SDK_${prefix}_ARCHITECTURES})
7777
message(STATUS " ${arch} ICU i18n INCLUDE: ${SWIFT_${prefix}_${arch}_ICU_I18N_INCLUDE}")
7878
message(STATUS " ${arch} ICU i18n LIB: ${SWIFT_${prefix}_${arch}_ICU_I18N}")
79+
message(STATUS " ${arch} ICU i18n static LIB: ${SWIFT_${prefix}_${arch}_ICU_I18N_STATIC}")
7980
message(STATUS " ${arch} ICU unicode INCLUDE: ${SWIFT_${prefix}_${arch}_ICU_UC_INCLUDE}")
8081
message(STATUS " ${arch} ICU unicode LIB: ${SWIFT_${prefix}_${arch}_ICU_UC}")
82+
message(STATUS " ${arch} ICU unicode static LIB: ${SWIFT_${prefix}_${arch}_ICU_UC_STATIC}")
8183
endforeach()
8284
endif()
8385
endif()

0 commit comments

Comments
 (0)