aboutsummaryrefslogtreecommitdiff
path: root/contrib/iostream3
diff options
context:
space:
mode:
authorVollstrecker <werner@vollstreckernet.de>2025-12-31 11:11:28 +0100
committerMark Adler <git@madler.net>2026-01-12 10:55:15 -0800
commit4db1cd9721f2a404a53edaa48a688db251d1daf5 (patch)
treed725965ff0656f53c2728a6ec2c8d8f016e67648 /contrib/iostream3
parentfb4bdb74122393e5c3f6ea767d272fed14c5eb60 (diff)
downloadzlib-4db1cd9721f2a404a53edaa48a688db251d1daf5.tar.gz
zlib-4db1cd9721f2a404a53edaa48a688db251d1daf5.tar.bz2
zlib-4db1cd9721f2a404a53edaa48a688db251d1daf5.zip
CMake: Added contrib/iostream3.
Diffstat (limited to 'contrib/iostream3')
-rw-r--r--contrib/iostream3/CMakeLists.txt92
1 files changed, 92 insertions, 0 deletions
diff --git a/contrib/iostream3/CMakeLists.txt b/contrib/iostream3/CMakeLists.txt
new file mode 100644
index 00000000..0f3bcd8e
--- /dev/null
+++ b/contrib/iostream3/CMakeLists.txt
@@ -0,0 +1,92 @@
1cmake_minimum_required(VERSION 3.12...3.31)
2
3set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
4
5project(
6 iostreamsV3
7 VERSION 1.0.0
8 LANGUAGES CXX
9 DESCRIPTION "A library for using C++ IOStreams with zlib V3"
10 HOMEPAGE_URL "https://www.zlib.net")
11
12option(ZLIB_IOSTREAM3_BUILD_SHARED "Enable building blast shared library" ON)
13option(ZLIB_IOSTREAM3_BUILD_STATIC "Enable building blast static library" ON)
14option(ZLIB_IOSTREAM3_BUILD_TESTING "Enable building tests for blast" ON)
15
16if(NOT DEFINED ZLIB_BUILD_IOSTREAM3)
17 if(ZLIB_IOSTREAM3_BUILD_SHARED)
18 list(APPEND REQUIRED_COMPONENTS "shared")
19 endif(ZLIB_IOSTREAM3_BUILD_SHARED)
20
21 if(ZLIB_IOSTREAM3_BUILD_STATIC)
22 list(APPEND REQUIRED_COMPONENTS "static")
23 endif(ZLIB_IOSTREAM3_BUILD_STATIC)
24
25 find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
26endif(NOT DEFINED ZLIB_BUILD_IOSTREAM3)
27
28if(WIN32 OR CYGWIN)
29 set(zlibIOStream3_static_suffix "s")
30 set(CMAKE_DEBUG_POSTFIX "d")
31endif(WIN32 OR CYGWIN)
32
33if(ZLIB_IOSTREAM3_BUILD_SHARED)
34 add_library(zlib-iostream3 SHARED
35 zfstream.cc
36 zfstream.h)
37
38 target_link_libraries(zlib-iostream3
39 PUBLIC ZLIB::ZLIB)
40
41 if(ZLIB_IOSTREAM3_BUILD_TESTING)
42 enable_testing()
43
44 add_executable(iostream-test test.cc)
45
46 target_link_libraries(iostream-test
47 PRIVATE zlib-iostream3)
48
49 add_test(NAME zlib_iostream3_test COMMAND iostream-test)
50
51 set_tests_properties(zlib_iostream3_test
52 PROPERTIES
53 FIXTURES_REQUIRED iostream3_cleanup)
54 endif(ZLIB_IOSTREAM3_BUILD_TESTING)
55endif(ZLIB_IOSTREAM3_BUILD_SHARED)
56
57if(ZLIB_IOSTREAM3_BUILD_STATIC)
58 add_library(zlib-iostream3Static STATIC
59 zfstream.cc
60 zfstream.h)
61
62 target_link_libraries(zlib-iostream3Static
63 INTERFACE ZLIB::ZLIBSTATIC)
64
65 set_target_properties(zlib-iostream3Static
66 PROPERTIES
67 OUTPUT_NAME zlib-iostream3${zlib_IOStream3_static_suffix})
68
69 if(ZLIB_IOSTREAM3_BUILD_TESTING)
70 enable_testing()
71
72 add_executable(iostream-testStatic test.cc)
73
74 target_link_libraries(iostream-testStatic
75 PRIVATE zlib-iostream3Static)
76 add_test(NAME zlib_iostream3_testStatic COMMAND iostream-testStatic)
77
78 set_tests_properties(zlib_iostream3_testStatic
79 PROPERTIES
80 FIXTURES_REQUIRED iostream3_cleanup)
81 endif(ZLIB_IOSTREAM3_BUILD_TESTING)
82endif(ZLIB_IOSTREAM3_BUILD_STATIC)
83
84if(ZLIB_IOSTREAM3_BUILD_TESTING)
85 add_test(NAME zlib_iostream3_cleanup COMMAND ${CMAKE_COMMAND} -E rm
86 ${CMAKE_CURRENT_BINARY_DIR}/test1.txt.gz
87 ${CMAKE_CURRENT_BINARY_DIR}/test2.txt.gz)
88
89 set_tests_properties(zlib_iostream3_cleanup
90 PROPERTIES
91 FIXTURES_CLEANUP zlib_iostream3_cleanup)
92endif(ZLIB_IOSTREAM3_BUILD_TESTING)