[CMake] Use builtin FindICU
https://bugs.webkit.org/show_bug.cgi?id=197934

Reviewed by Michael Catanzaro.

.:

Update CMake minimum required to 3.7. 3.7 has a FindICU module so the WebKit one
is removed. For non-Apple ports this just requires adding individual components of
ICU to find_package(ICU). For Apple ports the module does not work so the targets
created in FindICU are mirrored in target/icu.cmake.

* CMakeLists.txt:
* Source/cmake/FindICU.cmake: Removed.
* Source/cmake/OptionsAppleWin.cmake:
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsJSCOnly.cmake:
* Source/cmake/OptionsMac.cmake:
* Source/cmake/OptionsPlayStation.cmake:
* Source/cmake/OptionsWPE.cmake:
* Source/cmake/OptionsWin.cmake:
* Source/cmake/OptionsWinCairo.cmake:
* Source/cmake/target/icu.cmake: Added.

Source/JavaScriptCore:

Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.

* CMakeLists.txt:
* PlatformWin.cmake:

Source/WebCore:

Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.

* CMakeLists.txt:
* PlatformPlayStation.cmake:
* PlatformWPE.cmake:

Source/WebCore/PAL:

Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.

* pal/CMakeLists.txt:

Source/WebDriver:

Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.

* PlatformWPE.cmake:

Source/WebKit:

Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.

* CMakeLists.txt:

Source/WebKitLegacy:

Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.

* CMakeLists.txt:
* PlatformWin.cmake:

Source/WTF:

Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES. Use ICU:: targets which end
up propagating to all consumers of WTF.

* wtf/CMakeLists.txt:
* wtf/PlatformPlayStation.cmake:

Tools:

Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.

* TestWebKitAPI/PlatformMac.cmake:
* TestWebKitAPI/PlatformPlayStation.cmake:
* TestWebKitAPI/PlatformWin.cmake:
* WebKitTestRunner/CMakeLists.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245492 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3e8a23..e79f412 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,13 +2,13 @@
 # Determine CMake version and build type.
 # -----------------------------------------------------------------------------
 #
-# NOTE: cmake_minimum_required() and project() *MUST* be the two fist commands
+# NOTE: cmake_minimum_required() and project() *MUST* be the two first commands
 # used, see https://cmake.org/cmake/help/v3.3/command/project.html -- the
 # latter in particular handles loading a bunch of shared CMake definitions
 # and loading the cross-compilation settings from CMAKE_TOOLCHAIN_FILE.
 #
 
-cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.7)
 
 project(WebKit)
 
diff --git a/ChangeLog b/ChangeLog
index 0d5cfe4..05f1e22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2019-05-17  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake] Use builtin FindICU
+        https://bugs.webkit.org/show_bug.cgi?id=197934
+
+        Reviewed by Michael Catanzaro.
+
+        Update CMake minimum required to 3.7. 3.7 has a FindICU module so the WebKit one
+        is removed. For non-Apple ports this just requires adding individual components of
+        ICU to find_package(ICU). For Apple ports the module does not work so the targets
+        created in FindICU are mirrored in target/icu.cmake.
+
+        * CMakeLists.txt:
+        * Source/cmake/FindICU.cmake: Removed.
+        * Source/cmake/OptionsAppleWin.cmake:
+        * Source/cmake/OptionsGTK.cmake:
+        * Source/cmake/OptionsJSCOnly.cmake:
+        * Source/cmake/OptionsMac.cmake:
+        * Source/cmake/OptionsPlayStation.cmake:
+        * Source/cmake/OptionsWPE.cmake:
+        * Source/cmake/OptionsWin.cmake:
+        * Source/cmake/OptionsWinCairo.cmake:
+        * Source/cmake/target/icu.cmake: Added.
+
 2019-05-09  Xan López  <xan@igalia.com>
 
         [CMake] Detect SSE2 at compile time
diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt
index 5d6d170..e716c71 100644
--- a/Source/JavaScriptCore/CMakeLists.txt
+++ b/Source/JavaScriptCore/CMakeLists.txt
@@ -54,10 +54,6 @@
     list(APPEND JavaScriptCore_PRIVATE_INCLUDE_DIRECTORIES "${THIRDPARTY_DIR}/capstone/Source/include")
 endif ()
 
-set(JavaScriptCore_SYSTEM_INCLUDE_DIRECTORIES
-    "${ICU_INCLUDE_DIRS}"
-)
-
 set(JavaScriptCore_OBJECT_LUT_SOURCES
     runtime/ArrayConstructor.cpp
     runtime/AsyncFromSyncIteratorPrototype.cpp
@@ -121,7 +117,6 @@
 
 set(JavaScriptCore_LIBRARIES
     WTF${DEBUG_SUFFIX}
-    ${ICU_I18N_LIBRARIES}
 )
 
 if (USE_CAPSTONE)
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 82d5cfe..5511733 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,15 @@
+2019-05-17  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake] Use builtin FindICU
+        https://bugs.webkit.org/show_bug.cgi?id=197934
+
+        Reviewed by Michael Catanzaro.
+
+        Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.
+
+        * CMakeLists.txt:
+        * PlatformWin.cmake:
+
 2019-05-17  Keith Rollin  <krollin@apple.com>
 
         Re-enable generate-xcfilelists
diff --git a/Source/JavaScriptCore/PlatformWin.cmake b/Source/JavaScriptCore/PlatformWin.cmake
index 425b97e..c7d0ef5 100644
--- a/Source/JavaScriptCore/PlatformWin.cmake
+++ b/Source/JavaScriptCore/PlatformWin.cmake
@@ -27,7 +27,6 @@
 
 if (NOT WTF_PLATFORM_WIN_CAIRO)
     list(APPEND JavaScriptCore_LIBRARIES
-        ${ICU_LIBRARIES}
         winmm
     )
 endif ()
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index 492d7b0..e63fa88 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -1,3 +1,16 @@
+2019-05-17  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake] Use builtin FindICU
+        https://bugs.webkit.org/show_bug.cgi?id=197934
+
+        Reviewed by Michael Catanzaro.
+
+        Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES. Use ICU:: targets which end
+        up propagating to all consumers of WTF.
+
+        * wtf/CMakeLists.txt:
+        * wtf/PlatformPlayStation.cmake:
+
 2019-05-17  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r245418.
diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt
index 6d64080..07f501a 100644
--- a/Source/WTF/wtf/CMakeLists.txt
+++ b/Source/WTF/wtf/CMakeLists.txt
@@ -491,13 +491,11 @@
 
     unicode/icu/CollatorICU.cpp
 )
-set(WTF_SYSTEM_INCLUDE_DIRECTORIES
-    ${ICU_INCLUDE_DIRS}
-)
+
 list(APPEND WTF_LIBRARIES
-    ${ICU_DATA_LIBRARIES}
-    ${ICU_I18N_LIBRARIES}
-    ${ICU_LIBRARIES}
+    ICU::data
+    ICU::i18n
+    ICU::uc
 )
 
 WEBKIT_FRAMEWORK_DECLARE(WTF)
diff --git a/Source/WTF/wtf/PlatformPlayStation.cmake b/Source/WTF/wtf/PlatformPlayStation.cmake
index 1a524b1..932b2a3 100644
--- a/Source/WTF/wtf/PlatformPlayStation.cmake
+++ b/Source/WTF/wtf/PlatformPlayStation.cmake
@@ -17,7 +17,6 @@
 
 list(APPEND WTF_LIBRARIES
     ${CMAKE_THREAD_LIBS_INIT}
-    ${ICU_LIBRARIES}
 
     ${C_STD_LIBRARY}
     ${KERNEL_LIBRARY}
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index fd99e7d..4416f25 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -166,7 +166,6 @@
 )
 
 set(WebCore_SYSTEM_INCLUDE_DIRECTORIES
-    ${ICU_INCLUDE_DIRS}
     ${LIBXML2_INCLUDE_DIR}
     ${LIBXSLT_INCLUDE_DIR}
     ${SQLITE_INCLUDE_DIR}
@@ -1196,7 +1195,6 @@
 )
 
 set(WebCore_LIBRARIES
-    ${ICU_LIBRARIES}
     ${LIBXML2_LIBRARIES}
     ${LIBXSLT_LIBRARIES}
     ${SQLITE_LIBRARIES}
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index b3ce813..2912496 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2019-05-17  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake] Use builtin FindICU
+        https://bugs.webkit.org/show_bug.cgi?id=197934
+
+        Reviewed by Michael Catanzaro.
+
+        Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.
+
+        * CMakeLists.txt:
+        * PlatformPlayStation.cmake:
+        * PlatformWPE.cmake:
+
 2019-05-17  Alex Christensen  <achristensen@webkit.org>
 
         Enable legacy EME for iOS WKWebView
diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog
index 94807af..319be99 100644
--- a/Source/WebCore/PAL/ChangeLog
+++ b/Source/WebCore/PAL/ChangeLog
@@ -1,3 +1,14 @@
+2019-05-17  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake] Use builtin FindICU
+        https://bugs.webkit.org/show_bug.cgi?id=197934
+
+        Reviewed by Michael Catanzaro.
+
+        Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.
+
+        * pal/CMakeLists.txt:
+
 2019-05-15  Simon Fraser  <simon.fraser@apple.com>
 
         Make LOG_WITH_STREAM more efficient
diff --git a/Source/WebCore/PAL/pal/CMakeLists.txt b/Source/WebCore/PAL/pal/CMakeLists.txt
index c50c485..fc0091e 100644
--- a/Source/WebCore/PAL/pal/CMakeLists.txt
+++ b/Source/WebCore/PAL/pal/CMakeLists.txt
@@ -37,10 +37,6 @@
     "${PAL_DIR}/pal/text"
 )
 
-set(PAL_SYSTEM_INCLUDE_DIRECTORIES
-    ${ICU_INCLUDE_DIRS}
-)
-
 set(PAL_LIBRARIES
     JavaScriptCore${DEBUG_SUFFIX}
 )
diff --git a/Source/WebCore/PlatformPlayStation.cmake b/Source/WebCore/PlatformPlayStation.cmake
index d1ea46c..7193bc5 100644
--- a/Source/WebCore/PlatformPlayStation.cmake
+++ b/Source/WebCore/PlatformPlayStation.cmake
@@ -81,7 +81,6 @@
 )
 
 list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
-    ${ICU_INCLUDE_DIRS}
     ${LIBXML2_INCLUDE_DIR}
     ${SQLITE_INCLUDE_DIR}
     ${ZLIB_INCLUDE_DIRS}
@@ -89,7 +88,6 @@
 )
 
 list(APPEND WebCore_LIBRARIES
-    ${ICU_LIBRARIES}
     ${LIBXML2_LIBRARIES}
     ${SQLITE_LIBRARIES}
     ${ZLIB_LIBRARIES}
diff --git a/Source/WebCore/PlatformWPE.cmake b/Source/WebCore/PlatformWPE.cmake
index 1cad0e6..4100c81 100644
--- a/Source/WebCore/PlatformWPE.cmake
+++ b/Source/WebCore/PlatformWPE.cmake
@@ -52,7 +52,6 @@
     ${GLIB_GMODULE_LIBRARIES}
     ${GLIB_GOBJECT_LIBRARIES}
     ${GLIB_LIBRARIES}
-    ${ICU_LIBRARIES}
     ${LIBTASN1_LIBRARIES}
     ${UPOWERGLIB_LIBRARIES}
     ${WPE_LIBRARIES}
@@ -61,7 +60,6 @@
 list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
     ${GIO_UNIX_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
-    ${ICU_INCLUDE_DIRS}
     ${LIBTASN1_INCLUDE_DIRS}
     ${UPOWERGLIB_INCLUDE_DIRS}
     ${WPE_INCLUDE_DIRS}
diff --git a/Source/WebDriver/ChangeLog b/Source/WebDriver/ChangeLog
index e38b7bc..4049ce1 100644
--- a/Source/WebDriver/ChangeLog
+++ b/Source/WebDriver/ChangeLog
@@ -1,3 +1,14 @@
+2019-05-17  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake] Use builtin FindICU
+        https://bugs.webkit.org/show_bug.cgi?id=197934
+
+        Reviewed by Michael Catanzaro.
+
+        Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.
+
+        * PlatformWPE.cmake:
+
 2019-04-14  Don Olmstead  <don.olmstead@sony.com>
 
         [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore
diff --git a/Source/WebDriver/PlatformWPE.cmake b/Source/WebDriver/PlatformWPE.cmake
index ba21798..bd3cd81 100644
--- a/Source/WebDriver/PlatformWPE.cmake
+++ b/Source/WebDriver/PlatformWPE.cmake
@@ -2,7 +2,6 @@
 
 list(APPEND WebDriver_SYSTEM_INCLUDE_DIRECTORIES
     "${GLIB_INCLUDE_DIRS}"
-    "${ICU_INCLUDE_DIRS}"
     "${LIBSOUP_INCLUDE_DIRS}"
 )
 
diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt
index 4b0bec7..310f169 100644
--- a/Source/WebKit/CMakeLists.txt
+++ b/Source/WebKit/CMakeLists.txt
@@ -98,10 +98,6 @@
 
 set(PROTOCOL_GENERATOR_SCRIPTS_DIR "${JAVASCRIPTCORE_DIR}/inspector/scripts")
 
-set(WebKit_SYSTEM_INCLUDE_DIRECTORIES
-    ${ICU_INCLUDE_DIRS}
-)
-
 list(APPEND WebKit_UNIFIED_SOURCE_LIST_FILES
     "Sources.txt"
 )
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 7bb8241..fb9d26c 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2019-05-17  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake] Use builtin FindICU
+        https://bugs.webkit.org/show_bug.cgi?id=197934
+
+        Reviewed by Michael Catanzaro.
+
+        Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.
+
+        * CMakeLists.txt:
+
 2019-05-17  Alex Christensen  <achristensen@webkit.org>
 
         Enable legacy EME for iOS WKWebView
diff --git a/Source/WebKitLegacy/CMakeLists.txt b/Source/WebKitLegacy/CMakeLists.txt
index b0c77dd..960a970 100644
--- a/Source/WebKitLegacy/CMakeLists.txt
+++ b/Source/WebKitLegacy/CMakeLists.txt
@@ -25,10 +25,6 @@
     "${WebKitLegacy_DERIVED_SOURCES_DIR}"
 )
 
-set(WebKitLegacy_SYSTEM_INCLUDE_DIRECTORIES
-    "${ICU_INCLUDE_DIRS}"
-)
-
 set(WebKitLegacy_LIBRARIES
     PRIVATE JavaScriptCore${DEBUG_SUFFIX}
     PRIVATE WebCore${DEBUG_SUFFIX}
diff --git a/Source/WebKitLegacy/ChangeLog b/Source/WebKitLegacy/ChangeLog
index 69790e8..1dd54ea 100644
--- a/Source/WebKitLegacy/ChangeLog
+++ b/Source/WebKitLegacy/ChangeLog
@@ -1,3 +1,15 @@
+2019-05-17  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake] Use builtin FindICU
+        https://bugs.webkit.org/show_bug.cgi?id=197934
+
+        Reviewed by Michael Catanzaro.
+
+        Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.
+
+        * CMakeLists.txt:
+        * PlatformWin.cmake:
+
 2019-05-03  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r244881.
diff --git a/Source/WebKitLegacy/PlatformWin.cmake b/Source/WebKitLegacy/PlatformWin.cmake
index 7408928..b405d6d 100644
--- a/Source/WebKitLegacy/PlatformWin.cmake
+++ b/Source/WebKitLegacy/PlatformWin.cmake
@@ -24,8 +24,6 @@
         PRIVATE CoreText${DEBUG_SUFFIX}
         PRIVATE QuartzCore${DEBUG_SUFFIX}
         PRIVATE libdispatch${DEBUG_SUFFIX}
-        PRIVATE libicuin${DEBUG_SUFFIX}
-        PRIVATE libicuuc${DEBUG_SUFFIX}
         PRIVATE ${LIBXML2_LIBRARIES}
         PRIVATE ${LIBXSLT_LIBRARIES}
         PRIVATE ${SQLITE_LIBRARIES}
diff --git a/Source/cmake/FindICU.cmake b/Source/cmake/FindICU.cmake
deleted file mode 100644
index f9d79c1..0000000
--- a/Source/cmake/FindICU.cmake
+++ /dev/null
@@ -1,110 +0,0 @@
-# Finds the International Components for Unicode (ICU) Library
-#
-#  ICU_FOUND          - True if ICU found.
-#  ICU_I18N_FOUND     - True if ICU's internationalization library found.
-#  ICU_INCLUDE_DIRS   - Directory to include to get ICU headers
-#                       Note: always include ICU headers as, e.g.,
-#                       unicode/utypes.h
-#  ICU_LIBRARIES      - Libraries to link against for the common ICU
-#  ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
-#                       (note: in addition to ICU_LIBRARIES)
-
-find_package(PkgConfig)
-pkg_check_modules(PC_ICU icu-uc)
-
-# Look for the header file.
-find_path(
-    ICU_INCLUDE_DIR
-    NAMES unicode/utypes.h
-    HINTS ${PC_ICU_INCLUDE_DIRS}
-          ${PC_ICU_INCLUDEDIR}
-          ${WEBKIT_LIBRARIES_INCLUDE_DIR}
-    DOC "Include directory for the ICU library")
-mark_as_advanced(ICU_INCLUDE_DIR)
-
-# Look for the library.
-find_library(
-    ICU_LIBRARY
-    NAMES libicuuc cygicuuc cygicuuc32 icuuc
-    HINTS ${PC_ICU_LIBRARY_DIRS}
-          ${PC_ICU_LIBDIR}
-          ${WEBKIT_LIBRARIES_LINK_DIR}
-    DOC "Libraries to link against for the common parts of ICU")
-mark_as_advanced(ICU_LIBRARY)
-
-# Copy the results to the output variables.
-if (ICU_INCLUDE_DIR AND ICU_LIBRARY)
-    set(ICU_FOUND 1)
-    set(ICU_LIBRARIES ${ICU_LIBRARY})
-    set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
-
-    set(ICU_VERSION 0)
-    set(ICU_MAJOR_VERSION 0)
-    set(ICU_MINOR_VERSION 0)
-    file(READ "${ICU_INCLUDE_DIR}/unicode/uversion.h" _ICU_VERSION_CONENTS)
-    string(REGEX REPLACE ".*#define U_ICU_VERSION_MAJOR_NUM ([0-9]+).*" "\\1" ICU_MAJOR_VERSION "${_ICU_VERSION_CONENTS}")
-    string(REGEX REPLACE ".*#define U_ICU_VERSION_MINOR_NUM ([0-9]+).*" "\\1" ICU_MINOR_VERSION "${_ICU_VERSION_CONENTS}")
-
-    set(ICU_VERSION "${ICU_MAJOR_VERSION}.${ICU_MINOR_VERSION}")
-
-    # Look for the ICU internationalization libraries
-    pkg_check_modules(PC_ICU_I18N icu-i18n)
-    find_library(
-        ICU_I18N_LIBRARY
-        NAMES icui18n libicui18n libicuin cygicuin cygicuin32 icuin
-        HINTS ${PC_ICU_I18N_LIBRARY_DIRS}
-              ${PC_ICU_I18N_LIBDIR}
-              ${WEBKIT_LIBRARIES_LINK_DIR}
-        DOC "Libraries to link against for ICU internationalization")
-    mark_as_advanced(ICU_I18N_LIBRARY)
-    if (ICU_I18N_LIBRARY)
-        set(ICU_I18N_FOUND 1)
-        set(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY})
-    else ()
-        set(ICU_I18N_FOUND 0)
-        set(ICU_I18N_LIBRARIES)
-    endif ()
-
-    # Look for the ICU data libraries
-    find_library(
-        ICU_DATA_LIBRARY
-        NAMES icudata libicudata cygicudata cygicudata32
-        HINTS ${PC_ICU_I18N_LIBRARY_DIRS}
-              ${PC_ICU_I18N_LIBDIR}
-              ${WEBKIT_LIBRARIES_LINK_DIR}
-        DOC "Libraries to link against for ICU data")
-    mark_as_advanced(ICU_DATA_LIBRARY)
-    if (ICU_DATA_LIBRARY)
-        set(ICU_DATA_FOUND 1)
-        set(ICU_DATA_LIBRARIES ${ICU_DATA_LIBRARY})
-    else ()
-        set(ICU_DATA_FOUND 0)
-        set(ICU_DATA_LIBRARIES)
-    endif ()
-else ()
-    set(ICU_FOUND 0)
-    set(ICU_I18N_FOUND 0)
-    set(ICU_DATA_FOUND 0)
-    set(ICU_LIBRARIES)
-    set(ICU_I18N_LIBRARIES)
-    set(ICU_DATA_LIBRARIES)
-    set(ICU_INCLUDE_DIRS)
-    set(ICU_VERSION)
-    set(ICU_MAJOR_VERSION)
-    set(ICU_MINOR_VERSION)
-endif ()
-
-if (ICU_FOUND)
-    if (NOT ICU_FIND_QUIETLY)
-        message(STATUS "Found ICU header files in ${ICU_INCLUDE_DIRS}")
-        message(STATUS "Found ICU libraries: ${ICU_LIBRARIES}")
-        message(STATUS "Found ICU internationaliation libraries: ${ICU_I18N_LIBRARIES}")
-        message(STATUS "Found ICU data libraries: ${ICU_DATA_LIBRARIES}")
-    endif ()
-else ()
-    if (ICU_FIND_REQUIRED)
-        message(FATAL_ERROR "Could not find ICU")
-    else ()
-        message(STATUS "Optional package ICU was not found")
-    endif ()
-endif ()
diff --git a/Source/cmake/OptionsAppleWin.cmake b/Source/cmake/OptionsAppleWin.cmake
index 83810e4..df132f9 100644
--- a/Source/cmake/OptionsAppleWin.cmake
+++ b/Source/cmake/OptionsAppleWin.cmake
@@ -17,6 +17,8 @@
 set(ZLIB_INCLUDE_DIRS "${WEBKIT_LIBRARIES_DIR}/include/zlib")
 set(ZLIB_LIBRARIES zdll${DEBUG_SUFFIX})
 
+include(target/icu)
+
 # Uncomment the following line to try the Direct2D backend.
 # set(USE_DIRECT2D 1)
 
diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake
index d290bef..b21a58f 100644
--- a/Source/cmake/OptionsGTK.cmake
+++ b/Source/cmake/OptionsGTK.cmake
@@ -24,7 +24,7 @@
 find_package(GTK3 3.6.0 REQUIRED)
 find_package(GDK3 3.6.0 REQUIRED)
 find_package(HarfBuzz 0.9.2 REQUIRED)
-find_package(ICU REQUIRED)
+find_package(ICU REQUIRED COMPONENTS data i18n uc)
 find_package(JPEG REQUIRED)
 find_package(LibSoup 2.42.0 REQUIRED)
 find_package(LibXml2 2.8.0 REQUIRED)
diff --git a/Source/cmake/OptionsJSCOnly.cmake b/Source/cmake/OptionsJSCOnly.cmake
index 2affab7..16b3b25 100644
--- a/Source/cmake/OptionsJSCOnly.cmake
+++ b/Source/cmake/OptionsJSCOnly.cmake
@@ -96,9 +96,8 @@
 endif ()
 
 if (NOT APPLE)
-    find_package(ICU REQUIRED)
+    find_package(ICU REQUIRED COMPONENTS data i18n uc)
 else ()
     add_definitions(-DU_DISABLE_RENAMING=1 -DU_SHOW_CPLUSPLUS_API=0)
-    set(ICU_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/ICU/Headers)
-    set(ICU_LIBRARIES libicucore.dylib)
+    include(target/icu.cmake)
 endif ()
diff --git a/Source/cmake/OptionsMac.cmake b/Source/cmake/OptionsMac.cmake
index fc944e1..60f19f9 100644
--- a/Source/cmake/OptionsMac.cmake
+++ b/Source/cmake/OptionsMac.cmake
@@ -60,5 +60,4 @@
 set(WebCoreTestSupport_LIBRARY_TYPE SHARED)
 
 add_definitions(-DU_DISABLE_RENAMING=1 -DU_SHOW_CPLUSPLUS_API=0)
-set(ICU_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/ICU/Headers)
-set(ICU_LIBRARIES libicucore.dylib)
+include(target/icu.cmake)
diff --git a/Source/cmake/OptionsPlayStation.cmake b/Source/cmake/OptionsPlayStation.cmake
index a4e8793..3369af0 100644
--- a/Source/cmake/OptionsPlayStation.cmake
+++ b/Source/cmake/OptionsPlayStation.cmake
@@ -80,7 +80,7 @@
 find_package(Fontconfig REQUIRED)
 find_package(Freetype REQUIRED)
 find_package(HarfBuzz REQUIRED)
-find_package(ICU REQUIRED)
+find_package(ICU REQUIRED COMPONENTS data i18n uc)
 find_package(JPEG REQUIRED)
 find_package(LibPSL REQUIRED)
 find_package(LibXml2 REQUIRED)
diff --git a/Source/cmake/OptionsWPE.cmake b/Source/cmake/OptionsWPE.cmake
index 5f7f2f6..c71456a 100644
--- a/Source/cmake/OptionsWPE.cmake
+++ b/Source/cmake/OptionsWPE.cmake
@@ -17,7 +17,7 @@
 find_package(Freetype 2.4.2 REQUIRED)
 find_package(GLIB 2.40.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
 find_package(HarfBuzz 0.9.18 REQUIRED)
-find_package(ICU REQUIRED)
+find_package(ICU REQUIRED COMPONENTS data i18n uc)
 find_package(JPEG REQUIRED)
 find_package(LibEpoxy 1.4.0 REQUIRED)
 find_package(LibGcrypt 1.6.0 REQUIRED)
diff --git a/Source/cmake/OptionsWin.cmake b/Source/cmake/OptionsWin.cmake
index b6c1386..3e8f769 100644
--- a/Source/cmake/OptionsWin.cmake
+++ b/Source/cmake/OptionsWin.cmake
@@ -164,8 +164,6 @@
     set(WebCore_LIBRARY_TYPE OBJECT)
 endif ()
 
-find_package(ICU REQUIRED)
-
 # If <winsock2.h> is not included before <windows.h> redefinition errors occur
 # unless _WINSOCKAPI_ is defined before <windows.h> is included
 add_definitions(-D_WINSOCKAPI_=)
diff --git a/Source/cmake/OptionsWinCairo.cmake b/Source/cmake/OptionsWinCairo.cmake
index a716ec6..0fbad95 100644
--- a/Source/cmake/OptionsWinCairo.cmake
+++ b/Source/cmake/OptionsWinCairo.cmake
@@ -4,6 +4,7 @@
 
 find_package(Cairo 1.15.12 REQUIRED)
 find_package(CURL 7.60.0 REQUIRED)
+find_package(ICU REQUIRED COMPONENTS data i18n uc)
 find_package(JPEG 1.5.2 REQUIRED)
 find_package(LibXml2 2.9.7 REQUIRED)
 find_package(OpenSSL 2.0.0 REQUIRED)
diff --git a/Source/cmake/target/icu.cmake b/Source/cmake/target/icu.cmake
new file mode 100644
index 0000000..092eba5
--- /dev/null
+++ b/Source/cmake/target/icu.cmake
@@ -0,0 +1,48 @@
+# Apple ports provide their own ICU that can't be found by find_package(ICU).
+# This file will create targets that would be created by find_package(ICU).
+if (NOT TARGET ICU::data)
+    if (APPLE)
+        set(ICU_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/ICU/Headers)
+
+        # Apple just has a single dylib for ICU
+        set(ICU_I18N_LIBRARY libicucore.dylib)
+        set(ICU_UC_LIBRARY libicucore.dylib)
+        set(ICU_DATA_LIBRARY libicucore.dylib)
+
+        set(ICU_LIBRARIES ${ICU_UC_LIBRARY})
+    elseif (WIN32 AND NOT WTF_PLATFORM_WIN_CAIRO)
+        set(ICU_INCLUDE_DIRS ${WEBKIT_LIBRARIES_INCLUDE_DIR})
+
+        set(ICU_I18N_LIBRARY ${WEBKIT_LIBRARIES_LINK_DIR}/libicuin${DEBUG_SUFFIX}.lib)
+        set(ICU_UC_LIBRARY ${WEBKIT_LIBRARIES_LINK_DIR}/libicuuc${DEBUG_SUFFIX}.lib)
+
+        # AppleWin does not provide a separate data library
+        set(ICU_DATA_LIBRARY ${ICU_UC_LIBRARY})
+
+        set(ICU_LIBRARIES ${ICU_I18N_LIBRARY} ${ICU_UC_LIBRARY})
+    else ()
+        message(FATAL_ERROR "Could not find ICU targets. Use find_package(ICU REQUIRED data i1n8 uc)")
+    endif ()
+
+    # Emulate ICU:: targets
+    add_library(ICU::data UNKNOWN IMPORTED)
+    set_target_properties(ICU::data PROPERTIES
+        INTERFACE_INCLUDE_DIRECTORIES "${ICU_INCLUDE_DIRS}"
+        IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+        IMPORTED_LOCATION "${ICU_DATA_LIBRARY}"
+    )
+
+    add_library(ICU::i18n UNKNOWN IMPORTED)
+    set_target_properties(ICU::i18n PROPERTIES
+        INTERFACE_INCLUDE_DIRECTORIES "${ICU_INCLUDE_DIRS}"
+        IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+        IMPORTED_LOCATION "${ICU_I18N_LIBRARY}"
+    )
+
+    add_library(ICU::uc UNKNOWN IMPORTED)
+    set_target_properties(ICU::uc PROPERTIES
+        INTERFACE_INCLUDE_DIRECTORIES "${ICU_INCLUDE_DIRS}"
+        IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+        IMPORTED_LOCATION "${ICU_UC_LIBRARY}"
+    )
+endif ()
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 8a0c4e8..7a9ef1c 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,17 @@
+2019-05-17  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake] Use builtin FindICU
+        https://bugs.webkit.org/show_bug.cgi?id=197934
+
+        Reviewed by Michael Catanzaro.
+
+        Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.
+
+        * TestWebKitAPI/PlatformMac.cmake:
+        * TestWebKitAPI/PlatformPlayStation.cmake:
+        * TestWebKitAPI/PlatformWin.cmake:
+        * WebKitTestRunner/CMakeLists.txt:
+
 2019-05-17  Alex Christensen  <achristensen@webkit.org>
 
         Enable legacy EME for iOS WKWebView
diff --git a/Tools/TestWebKitAPI/PlatformMac.cmake b/Tools/TestWebKitAPI/PlatformMac.cmake
index 4e295d6..38925dc 100644
--- a/Tools/TestWebKitAPI/PlatformMac.cmake
+++ b/Tools/TestWebKitAPI/PlatformMac.cmake
@@ -17,7 +17,6 @@
     ${CARBON_LIBRARY}
     ${COCOA_LIBRARY}
     ${COREFOUNDATION_LIBRARY}
-    ${ICU_LIBRARIES}
 )
 
 list(APPEND TestWebKitAPI_LIBRARIES
diff --git a/Tools/TestWebKitAPI/PlatformPlayStation.cmake b/Tools/TestWebKitAPI/PlatformPlayStation.cmake
index abb8690f..952d043 100644
--- a/Tools/TestWebKitAPI/PlatformPlayStation.cmake
+++ b/Tools/TestWebKitAPI/PlatformPlayStation.cmake
@@ -10,10 +10,6 @@
     generic/UtilitiesGeneric.cpp
 )
 
-list(APPEND TestWTF_PRIVATE_INCLUDE_DIRECTORIES
-    ${ICU_INCLUDE_DIRS}
-)
-
 list(APPEND TestWebCore_SOURCES
     ${test_main_SOURCES}
 )
diff --git a/Tools/TestWebKitAPI/PlatformWin.cmake b/Tools/TestWebKitAPI/PlatformWin.cmake
index 651ea15..4aa7cd9 100644
--- a/Tools/TestWebKitAPI/PlatformWin.cmake
+++ b/Tools/TestWebKitAPI/PlatformWin.cmake
@@ -78,8 +78,6 @@
         WebKitQuartzCoreAdditions${DEBUG_SUFFIX}
         libdispatch${DEBUG_SUFFIX}
         libexslt${DEBUG_SUFFIX}
-        libicuin${DEBUG_SUFFIX}
-        libicuuc${DEBUG_SUFFIX}
     )
 endif ()
 
diff --git a/Tools/WebKitTestRunner/CMakeLists.txt b/Tools/WebKitTestRunner/CMakeLists.txt
index 34ff64a..632aa0b 100644
--- a/Tools/WebKitTestRunner/CMakeLists.txt
+++ b/Tools/WebKitTestRunner/CMakeLists.txt
@@ -51,7 +51,6 @@
 
 set(WebKitTestRunner_SYSTEM_INCLUDE_DIRECTORIES
     ${LIBSOUP_INCLUDE_DIRS}
-    ${ICU_INCLUDE_DIRS}
 )
 
 set(WebKitTestRunnerInjectedBundle_SOURCES