summaryrefslogtreecommitdiff
path: root/compat/zlib/test/add_subdirectory_test.cmake.in
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-09-04 09:05:24 +0200
committercashmere <cashmere@autistici.org>2026-09-04 09:05:24 +0200
commit4f49b16079b27d7ce633619e4cddfdf2bffbc952 (patch)
treec296c1e7f3c3e2f6859c6d3a1b1b208779b89679 /compat/zlib/test/add_subdirectory_test.cmake.in
downloadrelic-master.tar.gz
initial commitHEADmaster
Diffstat (limited to 'compat/zlib/test/add_subdirectory_test.cmake.in')
-rw-r--r--compat/zlib/test/add_subdirectory_test.cmake.in28
1 files changed, 28 insertions, 0 deletions
diff --git a/compat/zlib/test/add_subdirectory_test.cmake.in b/compat/zlib/test/add_subdirectory_test.cmake.in
new file mode 100644
index 0000000..4201af8
--- /dev/null
+++ b/compat/zlib/test/add_subdirectory_test.cmake.in
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 3.12...3.31)
+
+project(
+ zlib_find_package_test
+ LANGUAGES C
+ VERSION @zlib_VERSION@)
+
+enable_testing()
+option(ZLIB_BUILD_TESTING "" OFF)
+option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
+option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
+
+add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib)
+
+if(ZLIB_BUILD_SHARED)
+ add_executable(test_example @zlib_SOURCE_DIR@/test/example.c)
+ target_link_libraries(test_example ZLIB::ZLIB)
+
+ if(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll")
+ add_test(NAME zlib_test_example_shared COMMAND test_example)
+ endif(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll")
+endif(ZLIB_BUILD_SHARED)
+
+if(ZLIB_BUILD_STATIC)
+ add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
+ target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
+ add_test(NAME zlib_test_example_static COMMAND test_example_static)
+endif(@ZLIB_BUILD_STATIC)