Skip to content

Commit ab37c15

Browse files
Update libiconv no-rebuild-if-not-needed logic
1 parent 3537803 commit ab37c15

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

3rdparty/EPHelpers.cmake

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,17 @@ function(FilterDependsList DEPENDS_LIST)
1515
if (TARGET ${DEPENDENCY})
1616
message(STATUS "${DEPENDENCY} found as a target")
1717
list(APPEND RESULT ${DEPENDENCY})
18-
# Hardcoded skip for iconv, because it does not have pkg-config.pc
19-
# If iconv target not found, just assume it's either built already or not needed due to ANDROID-28+
20-
elseif(NOT "${DEPENDENCY}" STREQUAL "iconv")
18+
19+
elseif("${DEPENDENCY}" STREQUAL "iconv")
20+
# iconv does not have pkg-config.pc. Just check if the it exists.
21+
# ANDROID-28+ has it built in, no need.
22+
if (NOT (ANDROID_NATIVE_API_LEVEL GREATER_EQUAL 28))
23+
if (NOT EXISTS ${THIRDPARTY_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}iconv${CMAKE_STATIC_LIBRARY_SUFFIX})
24+
message(FATAL_ERROR "Missing dependency ${DEPENDENCY}!")
25+
endif()
26+
endif()
27+
28+
else()
2129
pkg_check_modules(LIBNAME REQUIRED ${DEPENDENCY})
2230
endif()
2331
endforeach(DEPENDENCY IN ITEMS ${INPUT})

3rdparty/packages/iconv.cmake

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
include_guard(GLOBAL)
22

3+
# iconv not needed on ANDROID-28+
4+
IF (ANDROID_NATIVE_API_LEVEL GREATER_EQUAL 28)
5+
return()
6+
endif()
7+
38
# libiconv doesn't provide pkg-config .pc
49
# Check if build sneeded, before calling to EPAutotools
5-
find_package(Iconv QUIET)
6-
7-
# Android >= 28 provides iconv
8-
IF ((NOT Iconv_FOUND) AND NOT (ANDROID_NATIVE_API_LEVEL GREATER_EQUAL 28))
9-
ExternalProjectAutotools(iconv
10-
URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
11-
URL_HASH SHA256=e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04
12-
)
10+
if (EXISTS ${THIRDPARTY_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}iconv${CMAKE_STATIC_LIBRARY_SUFFIX})
11+
return()
1312
endif()
13+
14+
ExternalProjectAutotools(iconv
15+
URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
16+
URL_HASH SHA256=e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04
17+
)

0 commit comments

Comments
 (0)