diff options
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 | 24 | ||||
-rw-r--r-- | Tests/RunCMake/AutoExportDll/AutoExport.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/AutoExportDll/hello2.c | 8 | ||||
-rw-r--r-- | Tests/RunCMake/AutoExportDll/say.cxx | 8 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0065/WARN-ON-stderr.txt | 2 |
8 files changed, 75 insertions, 1 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..64cc5d3 --- /dev/null +++ b/Tests/FindICU/Test/main.cpp @@ -0,0 +1,24 @@ +#include <unicode/uclean.h> +#include <unicode/ustring.h> +#include <unicode/utypes.h> + +#include <unicode/ucal.h> +#include <unicode/ucnv.h> +#include <unicode/udat.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); +} diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake index 3b2b2c5..bdddb38 100644 --- a/Tests/RunCMake/AutoExportDll/AutoExport.cmake +++ b/Tests/RunCMake/AutoExportDll/AutoExport.cmake @@ -3,5 +3,11 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${autoexport_BINARY_DIR}/bin) add_subdirectory(sub) add_library(autoexport SHARED hello.cxx world.cxx foo.c) + add_executable(say say.cxx) +if(MSVC) + set_target_properties(say PROPERTIES ENABLE_EXPORTS ON) + add_library(autoexport_for_exec SHARED hello2.c) + target_link_libraries(autoexport_for_exec say) +endif() target_link_libraries(say autoexport autoexport2) diff --git a/Tests/RunCMake/AutoExportDll/hello2.c b/Tests/RunCMake/AutoExportDll/hello2.c new file mode 100644 index 0000000..d4d6b72 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/hello2.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +extern int own_auto_export_function(int i); + +void hello2() +{ + printf("hello exec:%i", own_auto_export_function(41)); +} diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx index 0178688..9ca8d31 100644 --- a/Tests/RunCMake/AutoExportDll/say.cxx +++ b/Tests/RunCMake/AutoExportDll/say.cxx @@ -18,6 +18,14 @@ int bar(); void hello(); void world(); +// test exports for executable target +extern "C" { +int own_auto_export_function(int i) +{ + return i + 1; +} +} + int main() { // test static data (needs declspec to work) diff --git a/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt b/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt index dda4fe5..c31ec38 100644 --- a/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt +++ b/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt @@ -5,6 +5,6 @@ CMake Warning \(dev\) in CMakeLists.txt: set the policy and suppress this warning. For compatibility with older versions of CMake, additional flags may be - added to export symbols on all executables regardless of thier + added to export symbols on all executables regardless of their ENABLE_EXPORTS property. This warning is for project developers. Use -Wno-dev to suppress it. |