diff options
| author | Vollstrecker <werner@vollstreckernet.de> | 2025-12-24 14:17:25 +0100 |
|---|---|---|
| committer | Mark Adler <git@madler.net> | 2026-01-31 20:10:58 -0800 |
| commit | d3e5c539ed8a761137354208fe557edaa2059054 (patch) | |
| tree | 751812a1235eeabdba818e2cc4c3a22302a1ba26 /test/find_package_wrong_components_test.cmake.in | |
| parent | 88c13334882d3a3007ff5f5e708e216bc9c4b155 (diff) | |
| download | zlib-d3e5c539ed8a761137354208fe557edaa2059054.tar.gz zlib-d3e5c539ed8a761137354208fe557edaa2059054.tar.bz2 zlib-d3e5c539ed8a761137354208fe557edaa2059054.zip | |
CMake: Add components tests for zlib.
Diffstat (limited to 'test/find_package_wrong_components_test.cmake.in')
| -rw-r--r-- | test/find_package_wrong_components_test.cmake.in | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/find_package_wrong_components_test.cmake.in b/test/find_package_wrong_components_test.cmake.in new file mode 100644 index 00000000..fff4601c --- /dev/null +++ b/test/find_package_wrong_components_test.cmake.in | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.12...3.31) | ||
| 2 | |||
| 3 | project( | ||
| 4 | zlib_find_package_test | ||
| 5 | LANGUAGES C | ||
| 6 | VERSION @zlib_VERSION@) | ||
| 7 | |||
| 8 | enable_testing() | ||
| 9 | option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@) | ||
| 10 | option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@) | ||
| 11 | |||
| 12 | find_package(ZLIB @zlib_VERSION@ CONFIG COMPONENTS wrong REQUIRED) | ||
| 13 | |||
| 14 | if(ZLIB_BUILD_SHARED) | ||
| 15 | add_executable(test_example @zlib_SOURCE_DIR@/test/example.c) | ||
| 16 | target_link_libraries(test_example ZLIB::ZLIB) | ||
| 17 | |||
| 18 | if(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll") | ||
| 19 | add_test(NAME zlib_test_example_shared COMMAND test_example) | ||
| 20 | endif(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll") | ||
| 21 | endif(ZLIB_BUILD_SHARED) | ||
| 22 | |||
| 23 | if(ZLIB_BUILD_STATIC) | ||
| 24 | add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c) | ||
| 25 | target_link_libraries(test_example_static ZLIB::ZLIBSTATIC) | ||
| 26 | add_test(NAME zlib_test_example_static COMMAND test_example_static) | ||
| 27 | endif(ZLIB_BUILD_STATIC) | ||
