aboutsummaryrefslogtreecommitdiff
path: root/test/find_package_wrong_components_test.cmake.in
diff options
context:
space:
mode:
authorVollstrecker <werner@vollstreckernet.de>2025-12-24 14:17:25 +0100
committerMark Adler <git@madler.net>2026-01-31 20:10:58 -0800
commitd3e5c539ed8a761137354208fe557edaa2059054 (patch)
tree751812a1235eeabdba818e2cc4c3a22302a1ba26 /test/find_package_wrong_components_test.cmake.in
parent88c13334882d3a3007ff5f5e708e216bc9c4b155 (diff)
downloadzlib-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.in27
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 @@
1cmake_minimum_required(VERSION 3.12...3.31)
2
3project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
8enable_testing()
9option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
10option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
11
12find_package(ZLIB @zlib_VERSION@ CONFIG COMPONENTS wrong REQUIRED)
13
14if(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")
21endif(ZLIB_BUILD_SHARED)
22
23if(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)
27endif(ZLIB_BUILD_STATIC)