vcpkg/ports/libmariadb/fix-iconv.patch
jim wang c1de34e406
[libmariadb] Fix the issue of iconv search failure under Linux (#39136)
Fix one of https://github.com/microsoft/vcpkg/issues/32398 issue.
```
CMake Error at mariadb_config/CMakeLists.txt:51 (GET_LIB_NAME):
  GET_LIB_NAME Function invoked with incorrect arguments for function named:
  GET_LIB_NAME
```
Fixed the issue that the search for iconv in Linux did not obtain the
value of the macro variable Iconv_LIBRARIES, causing the function input
parameter check to fail.

- [X] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] ~~SHA512s are updated for each updated download.~~
- [ ] ~~The "supports" clause reflects platforms that may be fixed by
this new version.~~
- [ ] ~~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~~
- [ ] ~~Any patches that are no longer applied are deleted from the
port's directory.~~
- [X] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [X] Only one version is added to each modified port's versions file.

Usage test pass with following triplets:

```
x64-linux
```
2024-06-05 23:59:09 -07:00

41 lines
1.3 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 203fca7..65cc350 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -342,7 +342,8 @@ ENDIF()
IF(WITH_ICONV)
IF(NOT WIN32)
- INCLUDE(${CC_SOURCE_DIR}/cmake/FindIconv.cmake)
+ find_package(Iconv REQUIRED)
+ include_directories(${Iconv_INCLUDE_DIRS})
ENDIF()
ENDIF()
@@ -359,8 +360,8 @@ IF(WIN32)
SET(SYSTEM_LIBS ws2_32 advapi32 kernel32 shlwapi crypt32 ${LIBZ})
ELSE()
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBPTHREAD} ${CMAKE_DL_LIBS} ${LIBM})
- IF(ICONV_EXTERNAL)
- SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${ICONV_LIBRARIES})
+ IF(WITH_ICONV)
+ SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${Iconv_LIBRARIES})
ENDIF()
ENDIF()
IF(WITH_SSL)
diff --git a/mariadb_config/CMakeLists.txt b/mariadb_config/CMakeLists.txt
index 5bbf36b..70e619b 100644
--- a/mariadb_config/CMakeLists.txt
+++ b/mariadb_config/CMakeLists.txt
@@ -38,8 +38,8 @@ STRING(STRIP "${extra_dynamic_LDFLAGS}" extra_dynamic_LDFLAGS)
LIST(REMOVE_DUPLICATES extra_dynamic_LDFLAGS)
IF(UNIX AND NOT APPLE)
- IF(ICONV_EXTERNAL)
- GET_LIB_NAME(${ICONV_LIBRARIES} LIB_OUT)
+ IF(WITH_ICONV AND NOT Iconv_IS_BUILT_IN)
+ GET_LIB_NAME("${Iconv_LIBRARIES}" LIB_OUT)
SET(extra_dynamic_LDFLAGS "${extra_dynamic_LDFLAGS} ${LIB_OUT}")
ENDIF()
ENDIF()