Fossil SCM

fossil-scm / compat / zlib / README-cmake.md
1
# For building with cmake at least version 3.12 (minizip 3.12) is needed
2
3
In most cases the usual
4
5
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release
6
7
will create everything you need, however if you want something off default you can adjust several options fit your needs.
8
Every option is list below (excluding the cmake-standard options), they can be set via cmake-gui or on cmdline with
9
10
-D<option>=ON/OFF
11
12
## ZLIB-options with defaults ##
13
14
ZLIB_BUILD_TESTING=ON -- Enable Zlib Examples as tests
15
16
ZLIB_BUILD_SHARED=ON -- Enable building zlib shared library
17
18
ZLIB_BUILD_STATIC=ON -- Enable building zlib static library
19
20
ZLIB_BUILD_MINIZIP=ON -- Enable building libminizip contrib library
21
22
If this option is turned on, additional options are available from minizip (see below)
23
24
ZLIB_INSTALL=ON -- Enable installation of zlib
25
26
ZLIB_PREFIX=OFF -- prefix for all types and library functions, see zconf.h.in
27
28
This option is only on windows available and may/will be turned off and removed somewhen in the future.
29
If you rely cmake for finding and using zlib, this can be turned off, as `zlib1.dll` will never be used.
30
31
## minizip-options with defaults ##
32
33
MINIZIP_BUILD_SHARED=ON -- Enable building minizip shared library
34
35
MINIZIP_BUILD_STATIC=ON -- Enable building minizip static library
36
37
MINIZIP_BUILD_TESTING=ON -- Enable testing of minizip
38
39
MINIZIP_ENABLE_BZIP2=ON -- Build minizip withj bzip2 support
40
41
A usable installation of bzip2 is needed or config will fail. Turn this option of in this case.
42
43
MINIZIP_INSTALL=ON -- Enable installation of minizip
44
45
This option is only available on mingw as they tend to name this lib different. Maybe this will also be
46
removed in the future as. If you rely cmake for finding and using zlib, this can be turned off, as
47
the other file will never be used.
48
49
## Using the libs ##
50
51
To pull in what you need it's enough to just write
52
53
find_package(ZLIB CONFIG)
54
55
or
56
57
find_package(minizip CONFIG)
58
59
in your CMakeLists.txt, however it is advised to specify what you really want via:
60
61
find_package(ZLIB CONFIG COMPONENTS shared static REQUIRED)
62
63
or
64
65
find_package(minizip CONFIG COMPONENTS shared static REQUIRED)
66
67
As it's possible to only build the shared or the static lib, you can make sure that everything you need
68
is found. If no COMPONENTS are requested, everything needs to be found to satisfy your request. If the
69
libraries are optional in you project, you can omit the REQUIRED and check yourself if the targets you
70
want to link against are created.
71
72
When you search for minizip, it will search zlib for you, so only one of both is needed.
73
74
## Imported targets ##
75
76
When found the following targets are created for you:
77
78
ZLIB::ZLIB and ZLIB::ZLIBSTATIC -- for zlib
79
MINIZIP::minizip and MINIZIP::minizipstatic -- for minizip
80

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button