diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b274553..15e8c75 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt | |||
@@ -1,3 +1,76 @@ | |||
1 | function (ZLIB_findTestEnv testName) | ||
2 | set (testEnv "PATH=") | ||
3 | |||
4 | if (MSVC OR MINGW) | ||
5 | set (separator "\\\;") | ||
6 | else() | ||
7 | set (separator ":") | ||
8 | endif() | ||
9 | |||
10 | string (APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}") | ||
11 | string (APPEND testEnv "$ENV{PATH}") | ||
12 | |||
13 | set_tests_properties (${testName} PROPERTIES | ||
14 | ENVIRONMENT "${testEnv}" | ||
15 | ) | ||
16 | endfunction() | ||
17 | |||
18 | if(ZLIB_BUILD_SHARED) | ||
19 | add_executable(zlib_example example.c) | ||
20 | target_link_libraries(zlib_example ZLIB::ZLIB) | ||
21 | add_test(NAME zlib_example | ||
22 | COMMAND zlib_example) | ||
23 | |||
24 | add_executable(minigzip minigzip.c) | ||
25 | target_compile_definitions(zlib | ||
26 | PRIVATE | ||
27 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | ||
28 | target_link_libraries(minigzip ZLIB::ZLIB) | ||
29 | |||
30 | if (MSVC OR MSYS OR MINGW OR CYGWIN) | ||
31 | ZLIB_findTestEnv (zlib_example) | ||
32 | endif (MSVC OR MSYS OR MINGW OR CYGWIN) | ||
33 | |||
34 | if(HAVE_OFF64_T) | ||
35 | add_executable(zlib_example64 example.c) | ||
36 | target_compile_definitions(zlib_example64 | ||
37 | PRIVATE | ||
38 | LARGEFILE64_SOURCE=1 | ||
39 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | ||
40 | target_link_libraries(zlib_example64 ZLIB::ZLIB) | ||
41 | add_test(NAME zlib_example64 | ||
42 | COMMAND zlib_example64) | ||
43 | |||
44 | if (MSVC OR MSYS OR MINGW OR CYGWIN) | ||
45 | ZLIB_findTestEnv (zlib_example64) | ||
46 | endif (MSVC OR MSYS OR MINGW OR CYGWIN) | ||
47 | endif(HAVE_OFF64_T) | ||
48 | endif(ZLIB_BUILD_SHARED) | ||
49 | |||
50 | if(ZLIB_BUILD_STATIC) | ||
51 | add_executable(zlib_static_example example.c) | ||
52 | target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC) | ||
53 | target_compile_definitions(zlib_static_example | ||
54 | PRIVATE | ||
55 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | ||
56 | add_test(NAME zlib_static_example | ||
57 | COMMAND zlib_static_example) | ||
58 | |||
59 | add_executable(static_minigzip minigzip.c) | ||
60 | target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC) | ||
61 | |||
62 | if(HAVE_OFF64_T) | ||
63 | add_executable(zlib_static_example64 example.c) | ||
64 | target_compile_definitions(zlib_static_example64 | ||
65 | PRIVATE | ||
66 | LARGEFILE64_SOURCE=1 | ||
67 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | ||
68 | target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC) | ||
69 | add_test(NAME zlib_static_example64 | ||
70 | COMMAND zlib_static_example64) | ||
71 | endif(HAVE_OFF64_T) | ||
72 | endif(ZLIB_BUILD_STATIC) | ||
73 | |||
1 | add_test(NAME zlib_install | 74 | add_test(NAME zlib_install |
2 | COMMAND ${CMAKE_COMMAND} --install ${zlib_BINARY_DIR} | 75 | COMMAND ${CMAKE_COMMAND} --install ${zlib_BINARY_DIR} |
3 | --prefix ${CMAKE_CURRENT_BINARY_DIR}/test_install | 76 | --prefix ${CMAKE_CURRENT_BINARY_DIR}/test_install |