diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd716e3..7b694e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -346,7 +346,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()
 
@@ -363,8 +364,8 @@ IF(WIN32)
   SET(SYSTEM_LIBS ws2_32 advapi32 kernel32 shlwapi crypt32 ${LIBZ})
 ELSE()
   SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBPTHREAD} ${LIBDL} ${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)
+    GET_LIB_NAME(${Iconv_LIBRARIES} LIB_OUT)
     SET(extra_dynamic_LDFLAGS "${extra_dynamic_LDFLAGS} ${LIB_OUT}")
   ENDIF()
 ENDIF()