diff options
author | Vollstrecker <werner@vollstreckernet.de> | 2024-12-04 17:12:37 +0100 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2025-01-31 19:59:10 -0800 |
commit | 1fce5f2cdf7849c4e4116488bbb0927bf80a7f1b (patch) | |
tree | e3e9ce923798c99525bbfb6fbfa7d9416b82de7b /test/add_subdirectory_test.cmake.in | |
parent | 7dc2b782067d746aac2a348e411004135fb5fbda (diff) | |
download | zlib-1fce5f2cdf7849c4e4116488bbb0927bf80a7f1b.tar.gz zlib-1fce5f2cdf7849c4e4116488bbb0927bf80a7f1b.tar.bz2 zlib-1fce5f2cdf7849c4e4116488bbb0927bf80a7f1b.zip |
CMake: Add more tests.
Diffstat (limited to 'test/add_subdirectory_test.cmake.in')
-rw-r--r-- | test/add_subdirectory_test.cmake.in | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/add_subdirectory_test.cmake.in b/test/add_subdirectory_test.cmake.in new file mode 100644 index 0000000..c10f709 --- /dev/null +++ b/test/add_subdirectory_test.cmake.in | |||
@@ -0,0 +1,25 @@ | |||
1 | cmake_minimum_required(VERSION 3.5) | ||
2 | |||
3 | project(zlib_find_package_test | ||
4 | LANGUAGES C | ||
5 | VERSION ${zlib_VERSION}) | ||
6 | |||
7 | enable_testing() | ||
8 | set(ZLIB_BUILD_TESTING OFF) | ||
9 | add_subdirectory(${zlib_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/zlib) | ||
10 | |||
11 | if(${ZLIB_BUILD_SHARED}) | ||
12 | add_executable(test_example ${zlib_SOURCE_DIR}/test/example.c) | ||
13 | target_link_libraries(test_example ZLIB::ZLIB) | ||
14 | |||
15 | if(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll") | ||
16 | add_test(NAME zlib_test_example_shared COMMAND test_example) | ||
17 | endif(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll") | ||
18 | endif(${ZLIB_BUILD_SHARED}) | ||
19 | |||
20 | if(${ZLIB_BUILD_STATIC}) | ||
21 | add_executable(test_example_static ${zlib_SOURCE_DIR}/test/example.c) | ||
22 | target_link_libraries(test_example_static ZLIB::ZLIBSTATIC) | ||
23 | add_test(NAME zlib_test_example_static | ||
24 | COMMAND test_example_static) | ||
25 | endif(${ZLIB_BUILD_STATIC}) | ||