Skip to content

Commit 4227cff

Browse files
committed
handle FORCE_ON, look for shared libraries only for ICU
1 parent cb6227b commit 4227cff

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

llvm/cmake/config-ix.cmake

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,22 +259,31 @@ endif()
259259

260260
#Check for icu.
261261
if(LLVM_ENABLE_ICU)
262-
find_package(ICU COMPONENTS uc i18n)
263-
if(ICU_FOUND)
264-
set(HAVE_ICU 1)
262+
set(LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
263+
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so")
264+
if (LLVM_ENABLE_ICU STREQUAL FORCE_ON)
265+
find_package(ICU REQUIRED COMPONENTS uc i18n)
266+
if (NOT ICU_FOUND)
267+
message(FATAL_ERROR "Failed to configure icu, but LLVM_ENABLE_ICU is FORCE_ON")
268+
endif()
265269
else()
266-
set(HAVE_ICU 0)
270+
find_package(ICU COMPONENTS uc i18n)
267271
endif()
272+
set(HAVE_ICU ${ICU_FOUND})
273+
set(CMAKE_FIND_LIBRARY_SUFFIXES ${LIBRARY_SUFFIXES})
268274
endif()
269275

270276
# Check for iconv.
271277
if(LLVM_ENABLE_ICONV)
272-
find_package(Iconv)
273-
if(Iconv_FOUND)
274-
set(HAVE_ICONV 1)
278+
if (LLVM_ENABLE_ICONV STREQUAL FORCE_ON)
279+
find_package(Iconv REQUIRED)
280+
if (NOT Iconv_FOUND)
281+
message(FATAL_ERROR "Failed to configure iconv, but LLVM_ENABLE_ICONV is FORCE_ON")
282+
endif()
275283
else()
276-
set(HAVE_ICONV 0)
284+
find_package(Iconv)
277285
endif()
286+
set(HAVE_ICONV ${Iconv_FOUND})
278287
endif()
279288

280289
# function checks

0 commit comments

Comments
 (0)