add_library(libSceIcu SHARED EXCLUDE_FROM_ALL CharacterDigits.cpp Comparisons.cpp ConstrainedFieldPosition.cpp Enumeration.cpp ErrorName.cpp Export.cpp Invariant.cpp Iterator.cpp Numeric.cpp Set.cpp Tokenize.cpp Unescape.cpp Version.cpp Utf32.cpp JavaUtf8.cpp Compare.cpp Search.cpp Character.cpp Configuration.cpp LocaleCore.cpp Copy.cpp Utf16Search.cpp UtfConversions.cpp)
target_sources(libSceIcu PRIVATE ConverterFileSeparator.cpp)
target_include_directories(libSceIcu PRIVATE ${LIBS_INCLUDE_DIR})
target_sources(libSceIcu PRIVATE RecoveredInventory.cpp)
configure_windows_unwind(libSceIcu)
target_sources(libSceIcu PRIVATE ConverterCallbacks.cpp)
target_sources(libSceIcu PRIVATE LegacyExports.cpp)
target_sources(libSceIcu PRIVATE CString.cpp)
target_sources(libSceIcu PRIVATE ArrayComparators.cpp)
target_sources(libSceIcu PRIVATE List.cpp)
target_sources(libSceIcu PRIVATE AsciiStrings.cpp)
target_sources(libSceIcu PRIVATE CompareIter.cpp)
target_sources(libSceIcu PRIVATE Space.cpp)
target_sources(libSceIcu PRIVATE HashTable.cpp)
target_sources(libSceIcu PRIVATE Utf8.cpp)
target_sources(libSceIcu PRIVATE Resource.cpp StringPiece.cpp)
target_sources(libSceIcu PRIVATE DataInfo.cpp DataOpen.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_icu_string_piece_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/StringPiece.cpp)
    target_include_directories(guest_icu_string_piece_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_string_piece_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_string_piece_tests)
    add_test(NAME guest_icu_string_piece COMMAND guest_icu_string_piece_tests)
    if(WIN32)
        set_tests_properties(guest_icu_string_piece PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()
target_sources(libSceIcu PRIVATE Properties.cpp CaseMapping.cpp CaseProperties.cpp)
target_sources(libSceIcu PRIVATE Bidi.cpp CharsetDetection.cpp Normalization.cpp CodePoints.cpp)
target_link_libraries(libSceIcu PRIVATE icu_common icu_i18n)
target_sources(libSceIcu PRIVATE Availability.cpp StringHash.cpp InvariantChars.cpp)
target_sources(libSceIcu PRIVATE CollatorAvailability.cpp)
target_sources(libSceIcu PRIVATE DataSwap.cpp)
target_sources(libSceIcu PRIVATE Locale.cpp LocaleMap.cpp DefaultLocale.cpp)
target_sources(libSceIcu PRIVATE LocaleDisplay.cpp)
target_sources(libSceIcu PRIVATE UtcTime.cpp)
target_sources(libSceIcu PRIVATE NormalizerCombine.cpp)
target_sources(libSceIcu PRIVATE Normalizer2Accessors.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_icu_utc_time_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/UtcTime.cpp)
    target_include_directories(guest_icu_utc_time_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_utc_time_tests PRIVATE libSceIcu libkernel libc)
    configure_windows_unwind(guest_icu_utc_time_tests)
    add_test(NAME guest_icu_utc_time COMMAND guest_icu_utc_time_tests)
    set_tests_properties(guest_icu_utc_time PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_utc_time PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_locale_display_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/LocaleDisplay.cpp)
    target_include_directories(guest_icu_locale_display_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_locale_display_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_locale_display_tests)
    add_test(NAME guest_icu_locale_display COMMAND guest_icu_locale_display_tests)
    set_tests_properties(guest_icu_locale_display PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_locale_display PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_default_locale_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/DefaultLocale.cpp)
    target_include_directories(guest_icu_default_locale_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_default_locale_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_default_locale_tests)
    foreach(scenario posix messages codeset nynorsk long)
        add_test(NAME guest_icu_default_locale_${scenario} COMMAND guest_icu_default_locale_tests ${scenario})
        set_tests_properties(guest_icu_default_locale_${scenario} PROPERTIES TIMEOUT 20)
        if(WIN32)
            set_tests_properties(guest_icu_default_locale_${scenario} PROPERTIES ENVIRONMENT_MODIFICATION
                "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
        endif()
    endforeach()
endif()
target_sources(libSceIcu PRIVATE TerminateBuffer.cpp)
target_sources(libSceIcu PRIVATE CodePointTrie.cpp)
target_sources(libSceIcu PRIVATE LanguageTag.cpp)
target_sources(libSceIcu PRIVATE Script.cpp ScriptCode.cpp SupplementalRegion.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_icu_language_tag_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/LanguageTag.cpp)
    target_include_directories(guest_icu_language_tag_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_language_tag_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_language_tag_tests)
    add_test(NAME guest_icu_language_tag COMMAND guest_icu_language_tag_tests)
    set_tests_properties(guest_icu_language_tag PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_language_tag PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_supplemental_region_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/SupplementalRegion.cpp)
    target_include_directories(guest_icu_supplemental_region_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_supplemental_region_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_supplemental_region_tests)
    add_test(NAME guest_icu_supplemental_region COMMAND guest_icu_supplemental_region_tests)
    add_test(NAME guest_icu_supplemental_region_data COMMAND guest_icu_supplemental_region_tests
        "${PROJECT_SOURCE_DIR}/3rdparty/icu/icu4j/main/core/src/main/resources/com/ibm/icu/impl/data/icudata/langInfo.res")
    set_tests_properties(guest_icu_supplemental_region guest_icu_supplemental_region_data PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_supplemental_region guest_icu_supplemental_region_data PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_script_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Script.cpp)
    target_include_directories(guest_icu_script_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_script_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_script_tests)
    add_test(NAME guest_icu_script COMMAND guest_icu_script_tests)
    set_tests_properties(guest_icu_script PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_script PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_script_code_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/ScriptCode.cpp)
    target_include_directories(guest_icu_script_code_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_script_code_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_script_code_tests)
    add_test(NAME guest_icu_script_code COMMAND guest_icu_script_code_tests)
    set_tests_properties(guest_icu_script_code PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_script_code PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_locale_core_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuLocaleCore.cpp)
    target_include_directories(guest_icu_locale_core_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_locale_core_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_locale_core_tests)
    add_test(NAME guest_icu_locale_core COMMAND guest_icu_locale_core_tests)
    set_tests_properties(guest_icu_locale_core PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_locale_core PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_terminate_buffer_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/TerminateBuffer.cpp)
    target_include_directories(guest_icu_terminate_buffer_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_terminate_buffer_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_terminate_buffer_tests)
    add_test(NAME guest_icu_terminate_buffer COMMAND guest_icu_terminate_buffer_tests)
    set_tests_properties(guest_icu_terminate_buffer PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_terminate_buffer PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_locale_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Locale.cpp)
    target_include_directories(guest_icu_locale_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_locale_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_locale_tests)
    add_test(NAME guest_icu_locale COMMAND guest_icu_locale_tests)
    set_tests_properties(guest_icu_locale PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_locale PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_version_extents_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuVersionExtents.cpp)
    target_include_directories(guest_icu_version_extents_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_version_extents_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_version_extents_tests)
    add_test(NAME guest_icu_version_extents COMMAND guest_icu_version_extents_tests)
    set_tests_properties(guest_icu_version_extents PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_version_extents PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_character_digits_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/CharacterDigits.cpp)
    target_include_directories(guest_icu_character_digits_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_character_digits_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_character_digits_tests)
    add_test(NAME guest_icu_character_digits COMMAND guest_icu_character_digits_tests)
    set_tests_properties(guest_icu_character_digits PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_character_digits PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_utf8_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuUtf8.cpp)
    target_include_directories(guest_icu_utf8_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_utf8_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_utf8_tests)
    add_test(NAME guest_icu_utf8 COMMAND guest_icu_utf8_tests)
    set_tests_properties(guest_icu_utf8 PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_utf8 PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_cstring_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuCString.cpp)
    target_include_directories(guest_icu_cstring_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_cstring_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_cstring_tests)
    add_test(NAME guest_icu_cstring COMMAND guest_icu_cstring_tests)
    set_tests_properties(guest_icu_cstring PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_cstring PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_converter_callbacks_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuConverterCallbacks.cpp)
    target_include_directories(guest_icu_converter_callbacks_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_converter_callbacks_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_converter_callbacks_tests)
    add_test(NAME guest_icu_converter_callbacks COMMAND guest_icu_converter_callbacks_tests)
    set_tests_properties(guest_icu_converter_callbacks PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_converter_callbacks PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_converter_write_sub_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuConverterWriteSub.cpp)
    target_include_directories(guest_icu_converter_write_sub_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_converter_write_sub_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_converter_write_sub_tests)
    add_test(NAME guest_icu_converter_write_sub COMMAND guest_icu_converter_write_sub_tests)
    set_tests_properties(guest_icu_converter_write_sub PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_converter_write_sub PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_utf16_search_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuSearch.cpp)
    target_include_directories(guest_icu_utf16_search_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_utf16_search_tests PRIVATE libSceIcu libc libkernel icu_common)
    configure_windows_unwind(guest_icu_utf16_search_tests)
    add_test(NAME guest_icu_utf16_search COMMAND guest_icu_utf16_search_tests)
    set_tests_properties(guest_icu_utf16_search PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_utf16_search PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
    add_test_executable(guest_icu_version_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuVersion.cpp)
    target_include_directories(guest_icu_version_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_version_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_version_tests)
    add_test(NAME guest_icu_version COMMAND guest_icu_version_tests)
    set_tests_properties(guest_icu_version PROPERTIES TIMEOUT 10)
    add_test_executable(guest_icu_numeric_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuNumeric.cpp)
    target_include_directories(guest_icu_numeric_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_numeric_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_numeric_tests)
    add_test(NAME guest_icu_numeric COMMAND guest_icu_numeric_tests)
    set_tests_properties(guest_icu_numeric PROPERTIES TIMEOUT 10)
    add_test_executable(guest_icu_error_name_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuErrorName.cpp)
    target_include_directories(guest_icu_error_name_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_error_name_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_error_name_tests)
    add_test(NAME guest_icu_error_name COMMAND guest_icu_error_name_tests)
    set_tests_properties(guest_icu_error_name PROPERTIES TIMEOUT 10)
    add_test_executable(guest_icu_constrained_field_position_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuConstrainedFieldPosition.cpp)
    target_include_directories(guest_icu_constrained_field_position_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_constrained_field_position_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_constrained_field_position_tests)
    add_test(NAME guest_icu_constrained_field_position COMMAND guest_icu_constrained_field_position_tests)
    set_tests_properties(guest_icu_constrained_field_position PROPERTIES TIMEOUT 10)
    add_test_executable(guest_icu_set_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuSet.cpp)
    target_include_directories(guest_icu_set_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_set_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_set_tests)
    add_test(NAME guest_icu_set COMMAND guest_icu_set_tests)
    set_tests_properties(guest_icu_set PROPERTIES TIMEOUT 30)
    add_test_executable(guest_icu_enumeration_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuEnumeration.cpp)
    target_include_directories(guest_icu_enumeration_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_enumeration_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_enumeration_tests)
    add_test(NAME guest_icu_enumeration COMMAND guest_icu_enumeration_tests)
    set_tests_properties(guest_icu_enumeration PROPERTIES TIMEOUT 10)
    add_test_executable(guest_icu_iterator_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuIterator.cpp)
    target_include_directories(guest_icu_iterator_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_iterator_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_iterator_tests)
    add_test(NAME guest_icu_iterator COMMAND guest_icu_iterator_tests)
    set_tests_properties(guest_icu_iterator PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_version guest_icu_numeric guest_icu_error_name guest_icu_constrained_field_position guest_icu_set guest_icu_enumeration guest_icu_iterator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_space_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Space.cpp)
    target_include_directories(guest_icu_space_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_space_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_space_tests)
    add_test(NAME guest_icu_space COMMAND guest_icu_space_tests)
    set_tests_properties(guest_icu_space PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_space PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_unescape_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Unescape.cpp)
    target_include_directories(guest_icu_unescape_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_unescape_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_unescape_tests)
    add_test(NAME guest_icu_unescape COMMAND guest_icu_unescape_tests)
    set_tests_properties(guest_icu_unescape PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_unescape PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_compare_iter_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/CompareIter.cpp)
    target_include_directories(guest_icu_compare_iter_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_compare_iter_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_compare_iter_tests)
    add_test(NAME guest_icu_compare_iter COMMAND guest_icu_compare_iter_tests)
    set_tests_properties(guest_icu_compare_iter PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_compare_iter PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_resource_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Resource.cpp)
    target_include_directories(guest_icu_resource_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_resource_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_resource_tests)
    add_test(NAME guest_icu_resource COMMAND guest_icu_resource_tests)
    set_tests_properties(guest_icu_resource PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_resource PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_data_memory_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/DataInfo.cpp)
    target_include_directories(guest_icu_data_memory_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_data_memory_tests PRIVATE libSceIcu icu_common)
    configure_windows_unwind(guest_icu_data_memory_tests)
    add_test(NAME guest_icu_data_memory COMMAND guest_icu_data_memory_tests)
    set_tests_properties(guest_icu_data_memory PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_data_memory PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_utf_conversions_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuUtfConversions.cpp)
    target_include_directories(guest_icu_utf_conversions_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_utf_conversions_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_utf_conversions_tests)
    add_test(NAME guest_icu_utf_conversions COMMAND guest_icu_utf_conversions_tests)
    set_tests_properties(guest_icu_utf_conversions PROPERTIES TIMEOUT 10)
    add_test_executable(guest_icu_utf_memory_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuUtfMemory.cpp)
    target_include_directories(guest_icu_utf_memory_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_utf_memory_tests PRIVATE libSceIcu libkernel libc)
    configure_windows_unwind(guest_icu_utf_memory_tests)
    add_test(NAME guest_icu_utf_memory COMMAND guest_icu_utf_memory_tests)
    set_tests_properties(guest_icu_utf_memory PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_utf_conversions guest_icu_utf_memory PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()
target_sources(libSceIcu PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Utf16.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_icu_utf16_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Utf16.cpp)
    target_include_directories(guest_icu_utf16_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_utf16_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_utf16_tests)
    add_test(NAME guest_icu_utf16 COMMAND guest_icu_utf16_tests)
    set_tests_properties(guest_icu_utf16 PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_utf16 PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_tokenize_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuTokenize.cpp)
    target_include_directories(guest_icu_tokenize_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_tokenize_tests PRIVATE libSceIcu libkernel libc)
    configure_windows_unwind(guest_icu_tokenize_tests)
    add_test(NAME guest_icu_tokenize COMMAND guest_icu_tokenize_tests)
    set_tests_properties(guest_icu_tokenize PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_tokenize PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libkernel>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_comparison_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuComparisons.cpp)
    target_include_directories(guest_icu_comparison_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_comparison_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_comparison_tests)
    add_test(NAME guest_icu_comparisons COMMAND guest_icu_comparison_tests)
    set_tests_properties(guest_icu_comparisons PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_comparisons PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_utf32_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Utf32.cpp)
    target_include_directories(guest_icu_utf32_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_utf32_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_utf32_tests)
    add_test(NAME guest_icu_utf32 COMMAND guest_icu_utf32_tests)
    set_tests_properties(guest_icu_utf32 PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_utf32 PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_java_utf8_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/JavaUtf8.cpp)
    target_include_directories(guest_icu_java_utf8_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_java_utf8_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_java_utf8_tests)
    add_test(NAME guest_icu_java_utf8 COMMAND guest_icu_java_utf8_tests)
    set_tests_properties(guest_icu_java_utf8 PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_java_utf8 PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_compare_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Compare.cpp)
    target_include_directories(guest_icu_compare_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_compare_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_compare_tests)
    add_test(NAME guest_icu_compare COMMAND guest_icu_compare_tests)
    set_tests_properties(guest_icu_compare PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_compare PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_search_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Search.cpp)
    target_include_directories(guest_icu_search_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_search_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_search_tests)
    add_test(NAME guest_icu_search COMMAND guest_icu_search_tests)
    set_tests_properties(guest_icu_search PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_search PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_character_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Character.cpp)
    target_include_directories(guest_icu_character_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_character_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_character_tests)
    add_test(NAME guest_icu_character COMMAND guest_icu_character_tests)
    set_tests_properties(guest_icu_character PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_character PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_time_zone_cache_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/TimeZoneCache.cpp)
    target_include_directories(guest_icu_time_zone_cache_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_time_zone_cache_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_time_zone_cache_tests)
    add_test(NAME guest_icu_time_zone_cache COMMAND guest_icu_time_zone_cache_tests)
    set_tests_properties(guest_icu_time_zone_cache PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_time_zone_cache PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_configuration_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Configuration.cpp)
    target_include_directories(guest_icu_configuration_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_configuration_tests PRIVATE libSceIcu icu_common)
    configure_windows_unwind(guest_icu_configuration_tests)
    add_test(NAME guest_icu_configuration COMMAND guest_icu_configuration_tests)
    set_tests_properties(guest_icu_configuration PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_configuration PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_properties_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Properties.cpp)
    target_include_directories(guest_icu_properties_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_properties_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_properties_tests)
    add_test(NAME guest_icu_properties COMMAND guest_icu_properties_tests)
    set_tests_properties(guest_icu_properties PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_properties PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_code_point_trie_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/CodePointTrie.cpp)
    target_include_directories(guest_icu_code_point_trie_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_code_point_trie_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_code_point_trie_tests)
    add_test(NAME guest_icu_code_point_trie COMMAND guest_icu_code_point_trie_tests)
    set_tests_properties(guest_icu_code_point_trie PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_code_point_trie PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_null_locale_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/NullLocale.cpp)
    target_include_directories(guest_icu_null_locale_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_null_locale_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_null_locale_tests)
    foreach(scenario turkish arabic long)
        add_test(NAME guest_icu_null_locale_${scenario} COMMAND guest_icu_null_locale_tests ${scenario})
        set_tests_properties(guest_icu_null_locale_${scenario} PROPERTIES TIMEOUT 20)
        if(WIN32)
            set_tests_properties(guest_icu_null_locale_${scenario} PROPERTIES ENVIRONMENT_MODIFICATION
                "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
        endif()
    endforeach()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_case_mapping_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/CaseMapping.cpp)
    target_include_directories(guest_icu_case_mapping_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_case_mapping_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_case_mapping_tests)
    add_test(NAME guest_icu_case_mapping COMMAND guest_icu_case_mapping_tests)
    set_tests_properties(guest_icu_case_mapping PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_case_mapping PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_case_properties_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/CaseProperties.cpp)
    target_include_directories(guest_icu_case_properties_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_case_properties_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_case_properties_tests)
    add_test(NAME guest_icu_case_properties COMMAND guest_icu_case_properties_tests)
    set_tests_properties(guest_icu_case_properties PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_case_properties PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_unicode_data_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/UnicodeData.cpp)
    target_include_directories(guest_icu_unicode_data_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_compile_definitions(guest_icu_unicode_data_tests PRIVATE ANYPS5_ICU_UNICODE_DATA="${ICU_SOURCE_DIR}/data/unidata/UnicodeData.txt")
    target_link_libraries(guest_icu_unicode_data_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_unicode_data_tests)
    add_test(NAME guest_icu_unicode_data COMMAND guest_icu_unicode_data_tests)
    set_tests_properties(guest_icu_unicode_data PROPERTIES TIMEOUT 60)
    if(WIN32)
        set_tests_properties(guest_icu_unicode_data PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_bidi_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Bidi.cpp)
    target_include_directories(guest_icu_bidi_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_bidi_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_bidi_tests)
    add_test(NAME guest_icu_bidi COMMAND guest_icu_bidi_tests)
    set_tests_properties(guest_icu_bidi PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_bidi PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_charset_detection_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/CharsetDetection.cpp)
    target_include_directories(guest_icu_charset_detection_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_charset_detection_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_charset_detection_tests)
    add_test(NAME guest_icu_charset_detection COMMAND guest_icu_charset_detection_tests)
    set_tests_properties(guest_icu_charset_detection PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_charset_detection PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_normalization_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Normalization.cpp)
    target_include_directories(guest_icu_normalization_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_normalization_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_normalization_tests)
    add_test(NAME guest_icu_normalization COMMAND guest_icu_normalization_tests)
    set_tests_properties(guest_icu_normalization PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_normalization PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_code_points_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/CodePoints.cpp)
    target_include_directories(guest_icu_code_points_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_code_points_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_code_points_tests)
    add_test(NAME guest_icu_code_points COMMAND guest_icu_code_points_tests)
    set_tests_properties(guest_icu_code_points PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_code_points PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

target_sources(libSceIcu PRIVATE ConverterHelpers.cpp)
target_sources(libSceIcu PRIVATE ConverterCanonicalName.cpp)
target_sources(libSceIcu PRIVATE ConverterAvailableNames.cpp)
target_sources(libSceIcu PRIVATE ConverterAliases.cpp)
target_sources(libSceIcu PRIVATE LocaleSyntax.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_icu_locale_syntax_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuLocaleSyntax.cpp)
    target_include_directories(guest_icu_locale_syntax_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_locale_syntax_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_locale_syntax_tests)
    add_test(NAME guest_icu_locale_syntax COMMAND guest_icu_locale_syntax_tests)
    set_tests_properties(guest_icu_locale_syntax PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_locale_syntax PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_converter_canonical_name_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuConverterCanonicalName.cpp)
    target_include_directories(guest_icu_converter_canonical_name_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_converter_canonical_name_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_converter_canonical_name_tests)
    add_test(NAME guest_icu_converter_canonical_name COMMAND guest_icu_converter_canonical_name_tests)
    set_tests_properties(guest_icu_converter_canonical_name PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_converter_canonical_name PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
    add_test_executable(guest_icu_converter_aliases_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuConverterAliases.cpp)
    target_include_directories(guest_icu_converter_aliases_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_converter_aliases_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_converter_aliases_tests)
    add_test(NAME guest_icu_converter_aliases COMMAND guest_icu_converter_aliases_tests)
    set_tests_properties(guest_icu_converter_aliases PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_converter_aliases PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
    add_test_executable(guest_icu_converter_helpers_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuConverterHelpers.cpp)
    target_include_directories(guest_icu_converter_helpers_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_converter_helpers_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_converter_helpers_tests)
    add_test(NAME guest_icu_converter_helpers COMMAND guest_icu_converter_helpers_tests)
    set_tests_properties(guest_icu_converter_helpers PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_converter_helpers PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
    add_test_executable(guest_icu_converter_file_separator_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/ConverterFileSeparator.cpp)
    target_include_directories(guest_icu_converter_file_separator_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_converter_file_separator_tests PRIVATE libSceIcu libkernel libc icu_common)
    configure_windows_unwind(guest_icu_converter_file_separator_tests)
    add_test(NAME guest_icu_converter_file_separator COMMAND guest_icu_converter_file_separator_tests)
    set_tests_properties(guest_icu_converter_file_separator PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_converter_file_separator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
    add_test_executable(guest_icu_copy_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Copy.cpp)
    target_include_directories(guest_icu_copy_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_copy_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_copy_tests)
    add_test(NAME guest_icu_copy COMMAND guest_icu_copy_tests)
    set_tests_properties(guest_icu_copy PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_copy PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
    add_test_executable(guest_icu_copy_guest_memory_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/CopyGuestMemory.cpp)
    target_include_directories(guest_icu_copy_guest_memory_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_copy_guest_memory_tests PRIVATE libSceIcu libkernel libc)
    configure_windows_unwind(guest_icu_copy_guest_memory_tests)
    add_test(NAME guest_icu_copy_guest_memory COMMAND guest_icu_copy_guest_memory_tests)
    set_tests_properties(guest_icu_copy_guest_memory PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_copy_guest_memory PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_converter_available_names_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuConverterAvailableNames.cpp)
    target_include_directories(guest_icu_converter_available_names_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_converter_available_names_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_converter_available_names_tests)
    add_test(NAME guest_icu_converter_available_names COMMAND guest_icu_converter_available_names_tests)
    set_tests_properties(guest_icu_converter_available_names PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_converter_available_names PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

target_sources(libSceIcu PRIVATE AvailableLocales.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_icu_available_locales_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/AvailableLocales.cpp)
    target_include_directories(guest_icu_available_locales_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_available_locales_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_available_locales_tests)
    foreach(scenario errors data)
        add_test(NAME guest_icu_available_locales_${scenario} COMMAND guest_icu_available_locales_tests ${scenario})
        set_tests_properties(guest_icu_available_locales_${scenario} PROPERTIES TIMEOUT 20)
        if(WIN32)
            set_tests_properties(guest_icu_available_locales_${scenario} PROPERTIES ENVIRONMENT_MODIFICATION
                "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
        endif()
    endforeach()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_locale_map_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/LocaleMap.cpp)
    target_include_directories(guest_icu_locale_map_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_locale_map_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_locale_map_tests)
    add_test(NAME guest_icu_locale_map COMMAND guest_icu_locale_map_tests)
    set_tests_properties(guest_icu_locale_map PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_locale_map PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

set(ICU_RECOVERED_SOURCES
    Calendar.cpp
    Collator.cpp
    DataMemoryClose.cpp
    DateFormat.cpp
    DateIntervalFormat.cpp
    DateTimePatternGenerator.cpp
    FieldPositionIterator.cpp
    FormattedValue.cpp
    Idna.cpp
    ListFormatter.cpp
    LocaleDisplayNames.cpp
    NumberFormat.cpp
    NumberFormatter.cpp
    NumberingSystem.cpp
    PluralRules.cpp
    RelativeDateTimeFormatter.cpp
    ResourceBundle.cpp
    ResourceUtf8.cpp
    StringSearch.cpp
    UText.cpp)
target_sources(libSceIcu PRIVATE ${ICU_RECOVERED_SOURCES})

if(BUILD_TESTING)
    set(ICU_RECOVERED_TESTS
        tests/Calendar.cpp
        tests/Collator.cpp
        tests/DataMemoryClose.cpp
        tests/DateFormat.cpp
        tests/DateIntervalFormat.cpp
        tests/DateTimePatternGenerator.cpp
        tests/FieldPositionIterator.cpp
        tests/FormattedValue.cpp
        tests/Idna.cpp
        tests/ListFormatter.cpp
        tests/LocaleDisplayNames.cpp
        tests/NumberFormat.cpp
        tests/NumberFormatter.cpp
        tests/NumberingSystem.cpp
        tests/PluralRules.cpp
        tests/RecoveredSignatures.cpp
        tests/RelativeDateTimeFormatter.cpp
        tests/ResourceBundle.cpp
        tests/StringSearch.cpp
        tests/UText.cpp)
    list(TRANSFORM ICU_RECOVERED_TESTS PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/)
    add_test_executable(guest_icu_recovered_signatures_tests ${ICU_RECOVERED_TESTS})
    target_include_directories(guest_icu_recovered_signatures_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_recovered_signatures_tests PRIVATE libSceIcu icu_common)
    configure_windows_unwind(guest_icu_recovered_signatures_tests)
    add_test(NAME guest_icu_recovered_signatures COMMAND guest_icu_recovered_signatures_tests)
    set_tests_properties(guest_icu_recovered_signatures PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_recovered_signatures PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_resource_stack_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/ResourceStack.cpp)
    target_include_directories(guest_icu_resource_stack_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_resource_stack_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_resource_stack_tests)
    add_test(NAME guest_icu_resource_stack COMMAND guest_icu_resource_stack_tests)
    set_tests_properties(guest_icu_resource_stack PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_resource_stack PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()

    add_test_executable(guest_icu_resource_uint_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/ResourceUInt.cpp)
    target_include_directories(guest_icu_resource_uint_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_resource_uint_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_resource_uint_tests)
    add_test(NAME guest_icu_resource_uint COMMAND guest_icu_resource_uint_tests)
    set_tests_properties(guest_icu_resource_uint PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_resource_uint PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

target_sources(libSceIcu PRIVATE RightToLeft.cpp)

if(BUILD_TESTING)
    target_sources(libSceIcu PRIVATE tests/OpenStandardNamesSetup.cpp)
    add_test_executable(guest_icu_open_standard_names_tests tests/OpenStandardNames.cpp)
    target_include_directories(guest_icu_open_standard_names_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_open_standard_names_tests PRIVATE libSceIcu icu_common)
    configure_windows_unwind(guest_icu_open_standard_names_tests)
    add_test(NAME guest_icu_open_standard_names_reduced COMMAND guest_icu_open_standard_names_tests)
    add_test(NAME guest_icu_open_standard_names_full COMMAND guest_icu_open_standard_names_tests full)
    set_tests_properties(guest_icu_open_standard_names_reduced guest_icu_open_standard_names_full PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_open_standard_names_reduced guest_icu_open_standard_names_full PROPERTIES
            ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_right_to_left_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/RightToLeft.cpp)
    target_include_directories(guest_icu_right_to_left_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_right_to_left_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_right_to_left_tests)
    add_test(NAME guest_icu_right_to_left COMMAND guest_icu_right_to_left_tests)
    add_test_executable(guest_icu_right_to_left_data_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/RightToLeftData.cpp)
    target_include_directories(guest_icu_right_to_left_data_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_right_to_left_data_tests PRIVATE libSceIcu icu_common)
    configure_windows_unwind(guest_icu_right_to_left_data_tests)
    add_test(NAME guest_icu_right_to_left_data COMMAND guest_icu_right_to_left_data_tests
        "${PROJECT_SOURCE_DIR}/3rdparty/icu/icu4j/main/core/src/main/resources/com/ibm/icu/impl/data/icudata/langInfo.res")
    set_tests_properties(guest_icu_right_to_left guest_icu_right_to_left_data PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_right_to_left guest_icu_right_to_left_data PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_array_comparators_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuArrayComparators.cpp)
    target_include_directories(guest_icu_array_comparators_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_array_comparators_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_array_comparators_tests)
    add_test(NAME guest_icu_array_comparators COMMAND guest_icu_array_comparators_tests)
    set_tests_properties(guest_icu_array_comparators PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_array_comparators PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_list_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuList.cpp)
    target_include_directories(guest_icu_list_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_list_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_list_tests)
    add_test(NAME guest_icu_list COMMAND guest_icu_list_tests)
    set_tests_properties(guest_icu_list PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_list PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_ascii_strings_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuAsciiStrings.cpp)
    target_include_directories(guest_icu_ascii_strings_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_ascii_strings_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_ascii_strings_tests)
    add_test(NAME guest_icu_ascii_strings COMMAND guest_icu_ascii_strings_tests)
    set_tests_properties(guest_icu_ascii_strings PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_ascii_strings PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_hash_tests ${LIBS_INCLUDE_DIR}/tests/GuestIcuHash.cpp ${LIBS_INCLUDE_DIR}/tests/GuestIcuHashReference.cpp)
    target_include_directories(guest_icu_hash_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_hash_tests PRIVATE libSceIcu icu_common)
    configure_windows_unwind(guest_icu_hash_tests)
    add_test(NAME guest_icu_hash COMMAND guest_icu_hash_tests)
    set_tests_properties(guest_icu_hash PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_hash PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

target_sources(libSceIcu PRIVATE Mutex.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_icu_mutex_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Mutex.cpp)
    target_include_directories(guest_icu_mutex_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_mutex_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_mutex_tests)
    add_test(NAME guest_icu_mutex COMMAND guest_icu_mutex_tests)
    set_tests_properties(guest_icu_mutex PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_mutex PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()
target_sources(libSceIcu PRIVATE LocaleKeys.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_icu_locale_keys_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/LocaleKeys.cpp)
    target_include_directories(guest_icu_locale_keys_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_locale_keys_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_locale_keys_tests)
    add_test(NAME guest_icu_locale_keys COMMAND guest_icu_locale_keys_tests)
    set_tests_properties(guest_icu_locale_keys PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_locale_keys PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_converter_package_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/ConverterPackage.cpp)
    target_include_directories(guest_icu_converter_package_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_converter_package_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_converter_package_tests)
    add_test(NAME guest_icu_converter_package COMMAND guest_icu_converter_package_tests)
    set_tests_properties(guest_icu_converter_package PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_converter_package PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_field_position_iterator_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/FieldPositionIteratorBehavior.cpp)
    target_include_directories(guest_icu_field_position_iterator_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_field_position_iterator_tests PRIVATE libSceIcu icu_i18n)
    configure_windows_unwind(guest_icu_field_position_iterator_tests)
    add_test(NAME guest_icu_field_position_iterator COMMAND guest_icu_field_position_iterator_tests)
    set_tests_properties(guest_icu_field_position_iterator PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_field_position_iterator PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_collator_availability_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/CollatorAvailability.cpp)
    target_include_directories(guest_icu_collator_availability_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_collator_availability_tests PRIVATE libSceIcu libc libkernel icu_common)
    configure_windows_unwind(guest_icu_collator_availability_tests)
    foreach(mode empty data)
        add_test(NAME guest_icu_collator_availability_${mode} COMMAND guest_icu_collator_availability_tests ${mode})
        set_tests_properties(guest_icu_collator_availability_${mode} PROPERTIES TIMEOUT 20)
        if(WIN32)
            set_tests_properties(guest_icu_collator_availability_${mode} PROPERTIES ENVIRONMENT_MODIFICATION
                "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
        endif()
    endforeach()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_data_swap_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/DataSwap.cpp)
    target_include_directories(guest_icu_data_swap_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_compile_definitions(guest_icu_data_swap_tests PRIVATE ANYPS5_ICU_SOURCE_DIR="${ICU_SOURCE_DIR}"
        ANYPS5_ICU4J_DIR="${PROJECT_SOURCE_DIR}/3rdparty/icu/icu4j/main")
    target_link_libraries(guest_icu_data_swap_tests PRIVATE libSceIcu libc libkernel icu_common)
    configure_windows_unwind(guest_icu_data_swap_tests)
    add_test(NAME guest_icu_data_swap COMMAND guest_icu_data_swap_tests)
    set_tests_properties(guest_icu_data_swap PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_data_swap PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_availability_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Availability.cpp)
    target_include_directories(guest_icu_availability_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_availability_tests PRIVATE libSceIcu libc libkernel)
    configure_windows_unwind(guest_icu_availability_tests)
    add_test(NAME guest_icu_availability COMMAND guest_icu_availability_tests)
    set_tests_properties(guest_icu_availability PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_availability PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_invariant_chars_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/InvariantChars.cpp)
    target_include_directories(guest_icu_invariant_chars_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_invariant_chars_tests PRIVATE libSceIcu libc libkernel)
    configure_windows_unwind(guest_icu_invariant_chars_tests)
    add_test(NAME guest_icu_invariant_chars COMMAND guest_icu_invariant_chars_tests)
    set_tests_properties(guest_icu_invariant_chars PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_invariant_chars PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
    add_test_executable(guest_icu_string_hash_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/StringHash.cpp)
    target_include_directories(guest_icu_string_hash_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_string_hash_tests PRIVATE libSceIcu libc libkernel)
    configure_windows_unwind(guest_icu_string_hash_tests)
    add_test(NAME guest_icu_string_hash COMMAND guest_icu_string_hash_tests)
    set_tests_properties(guest_icu_string_hash PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_string_hash PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_delete_uobject_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/DeleteUObject.cpp)
    target_include_directories(guest_icu_delete_uobject_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_delete_uobject_tests PRIVATE libSceIcu)
    configure_windows_unwind(guest_icu_delete_uobject_tests)
    add_test(NAME guest_icu_delete_uobject COMMAND guest_icu_delete_uobject_tests)
    set_tests_properties(guest_icu_delete_uobject PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_delete_uobject PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_functional_equivalent_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/FunctionalEquivalent.cpp)
    target_include_directories(guest_icu_functional_equivalent_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_functional_equivalent_tests PRIVATE libSceIcu icu_common)
    configure_windows_unwind(guest_icu_functional_equivalent_tests)
    add_test(NAME guest_icu_functional_equivalent COMMAND guest_icu_functional_equivalent_tests)
    set_tests_properties(guest_icu_functional_equivalent PROPERTIES TIMEOUT 10)
    if(WIN32)
        set_tests_properties(guest_icu_functional_equivalent PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_resource_utf8_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/ResourceUtf8.cpp)
    target_include_directories(guest_icu_resource_utf8_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_resource_utf8_tests PRIVATE libSceIcu libc libkernel)
    configure_windows_unwind(guest_icu_resource_utf8_tests)
    add_test(NAME guest_icu_resource_utf8 COMMAND guest_icu_resource_utf8_tests)
    set_tests_properties(guest_icu_resource_utf8 PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_resource_utf8 PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

target_sources(libSceIcu PRIVATE KeywordList.cpp LocaleTableFallback.cpp)

if(BUILD_TESTING)
    add_test_executable(guest_icu_keyword_list_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/KeywordList.cpp)
    target_include_directories(guest_icu_keyword_list_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_keyword_list_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_keyword_list_tests)
    add_test(NAME guest_icu_keyword_list COMMAND guest_icu_keyword_list_tests)
    set_tests_properties(guest_icu_keyword_list PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_keyword_list PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_locale_table_fallback_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/LocaleTableFallback.cpp)
    target_include_directories(guest_icu_locale_table_fallback_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_locale_table_fallback_tests PRIVATE libSceIcu libc icu_common)
    configure_windows_unwind(guest_icu_locale_table_fallback_tests)
    add_test(NAME guest_icu_locale_table_fallback COMMAND guest_icu_locale_table_fallback_tests)
    set_tests_properties(guest_icu_locale_table_fallback PROPERTIES TIMEOUT 20)
    if(WIN32)
        set_tests_properties(guest_icu_locale_table_fallback PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_normalizer_combine_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/NormalizerCombine.cpp)
    target_include_directories(guest_icu_normalizer_combine_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_normalizer_combine_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_normalizer_combine_tests)
    add_test(NAME guest_icu_normalizer_combine COMMAND guest_icu_normalizer_combine_tests)
    set_tests_properties(guest_icu_normalizer_combine PROPERTIES TIMEOUT 30)
    if(WIN32)
        set_tests_properties(guest_icu_normalizer_combine PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()

if(BUILD_TESTING)
    add_test_executable(guest_icu_normalizer2_accessors_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/Normalizer2Accessors.cpp)
    target_include_directories(guest_icu_normalizer2_accessors_tests PRIVATE ${LIBS_INCLUDE_DIR})
    target_link_libraries(guest_icu_normalizer2_accessors_tests PRIVATE libSceIcu libc)
    configure_windows_unwind(guest_icu_normalizer2_accessors_tests)
    add_test(NAME guest_icu_normalizer2_accessors COMMAND guest_icu_normalizer2_accessors_tests)
    set_tests_properties(guest_icu_normalizer2_accessors PROPERTIES TIMEOUT 60)
    if(WIN32)
        set_tests_properties(guest_icu_normalizer2_accessors PROPERTIES ENVIRONMENT_MODIFICATION
            "PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIcu>")
    endif()
endif()
