diff options
author | Brad King <brad.king@kitware.com> | 2016-07-13 13:26:55 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-07-13 13:26:55 (GMT) |
commit | 291e41855c9afd473e3e5818c5432b684f225756 (patch) | |
tree | 2a59d2a5c83d10d5dccf69768045b5de6089844c /Tests | |
parent | 7a31a2717b69a32f0e79265dc997ca9cf215a13c (diff) | |
parent | e3bff7b3af6257caff24a43e3afd59e087f4e9d8 (diff) | |
download | CMake-291e41855c9afd473e3e5818c5432b684f225756.zip CMake-291e41855c9afd473e3e5818c5432b684f225756.tar.gz CMake-291e41855c9afd473e3e5818c5432b684f225756.tar.bz2 |
Merge topic 'findicu'
e3bff7b3 Help: Add notes for topic 'findicu'
4a63be15 FindICU: New module
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/FindICU/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindICU/Test/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/FindICU/Test/main.cpp | 25 |
4 files changed, 53 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b3d61bd..2d234db 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1384,6 +1384,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindGTest) endif() + if(CMake_TEST_FindICU) + add_subdirectory(FindICU) + endif() + if(CMake_TEST_FindJsonCpp) add_subdirectory(FindJsonCpp) endif() diff --git a/Tests/FindICU/CMakeLists.txt b/Tests/FindICU/CMakeLists.txt new file mode 100644 index 0000000..4acaaf2 --- /dev/null +++ b/Tests/FindICU/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindICU.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindICU/Test" + "${CMake_BINARY_DIR}/Tests/FindICU/Test" + ${build_generator_args} + --build-project TestFindICU + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindICU/Test/CMakeLists.txt b/Tests/FindICU/Test/CMakeLists.txt new file mode 100644 index 0000000..1247ac7 --- /dev/null +++ b/Tests/FindICU/Test/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindICU LANGUAGES CXX) +include(CTest) + +find_package(ICU REQUIRED COMPONENTS i18n uc) + +add_executable(test_icu_tgt main.cpp) +target_link_libraries(test_icu_tgt ICU::i18n ICU::uc) +add_test(NAME test_icu_tgt COMMAND test_icu_tgt) + +add_executable(test_icu_var main.cpp) +target_include_directories(test_icu_var PRIVATE ${ICU_INCLUDE_DIRS}) +target_link_libraries(test_icu_var PRIVATE ${ICU_LIBRARIES}) +add_test(NAME test_icu_var COMMAND test_icu_var) diff --git a/Tests/FindICU/Test/main.cpp b/Tests/FindICU/Test/main.cpp new file mode 100644 index 0000000..73c3ee1 --- /dev/null +++ b/Tests/FindICU/Test/main.cpp @@ -0,0 +1,25 @@ +#include <unicode/utypes.h> +#include <unicode/ustring.h> +#include <unicode/uclean.h> + +#include <unicode/ucnv.h> +#include <unicode/udat.h> +#include <unicode/ucal.h> + +int +main() +{ + UConverter *cnv = 0; + UErrorCode status = U_ZERO_ERROR; + ucnv_open(NULL, &status); + + UChar uchars[100]; + const char *chars = "Test"; + if(cnv&&U_SUCCESS(status)) { + int32_t len = ucnv_toUChars(cnv, uchars, 100, chars, -1, &status); + } + + ucnv_close(cnv); + u_cleanup(); + return (U_FAILURE(status) ? 1 : 0); +} |