Skip to content

Commit

Permalink
Fix format of README-cmake.md file
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausKlein committed Jan 2, 2025
1 parent da6e127 commit 169a528
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions README-cmake.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
For building with cmake at least version 3.10 (minizip 3.12) is needed
# For building with cmake at least version 3.12 (minizip 3.12) is needed

In most cases the usual "mkdir build && cd build && cmake .." will create everything you need, however
if you want something off default you can adjust several options fit your needs. Every option is
list below (excluding the cmake-standard options), they can be set via cmake-gui or on cmdline with
In most cases the usual

cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Release`

will create everything you need, however if you want something off default you can adjust several options fit your needs.
Every option is list below (excluding the cmake-standard options), they can be set via cmake-gui or on cmdline with

-D<option>=ON/OFF

Expand All @@ -15,30 +18,34 @@ list below (excluding the cmake-standard options), they can be set via cmake-gui
ZLIB_BUILD_STATIC=ON -- Enable building zlib static library

ZLIB_BUILD_MINIZIP=ON -- Enable building libminizip contrib library

If this option is turned on, additional options are available from minizip (see below)

ZLIB_INSTALL=ON -- Enable installation of zlib

ZLIB_PREFIX=OFF -- prefix for all types and library functions, see zconf.h.in

ZLIB_INSTALL_COMPAT_DLL=ON -- Install a copy as zlib1.dll

This option is only on windows available and may/will be turned off and removed somewhen in the future.
If you rely cmake for finding and using zlib, this can be turned off, as zlib1.dll will never be used.
If you rely cmake for finding and using zlib, this can be turned off, as `zlib1.dll` will never be used.

## minizip-options with defaults ##

MINIZIP_BUILD_SHARED=ON Enable building minizip shared library
MINIZIP_BUILD_SHARED=ON -- Enable building minizip shared library

MINIZIP_BUILD_STATIC=ON -- Enable building minizip static library

MINIZIP_BUILD_STATIC=ON Enable building minizip static library
MINIZIP_BUILD_TESTING=ON -- Enable testing of minizip

MINIZIP_BUILD_TESTING=ON Enable testing of minizip
MINIZIP_ENABLE_BZIP2=ON -- Build minizip withj bzip2 support

MINIZIP_ENABLE_BZIP2=ON Build minizip withj bzip2 support
A usable installation of bzip2 is needed or config will fail. Turn this option of in this case.

MINIZIP_INSTALL=ON Enable installation of minizip
MINIZIP_INSTALL=ON -- Enable installation of minizip

MINIZIP_INSTALL_COMPAT_DLL=ON -- Install a copy as libminizip-1.dll

MINIZIP_INSTALL_COMPAT_DLL=ON Install a copy as libminizip-1.dll
This option is only available on mingw as they tend to name this lib different. Maybe this will also be
removed in the future as. If you rely cmake for finding and using zlib, this can be turned off, as
the other file will never be used.
Expand All @@ -48,13 +55,17 @@ the other file will never be used.
To pull in what you need it's enough to just write

find_package(ZLIB CONFIG)

or

find_package(minizip CONFIG)

in your CMakeLists.txt, however it is advised to specify what you really want via:

find_package(ZLIB CONFIG COMPONENTS shared static REQUIRED)

or

find_package(minizip CONFIG COMPONENTS shared static REQUIRED)

As it's possible to only build the shared or the static lib, you can make sure that everything you need
Expand All @@ -68,10 +79,10 @@ When you search for minizip, it will search zlib for you, so only one of both is

When found the following targets are created for you:

ZLIB::ZLIB and ZLIB:ZLIBSTATIC for zlib
MINIZIP::minizip and MINIZIP::minizipstatic for minizip
ZLIB::ZLIB and ZLIB::ZLIBSTATIC -- for zlib
MINIZIP::minizip and MINIZIP::minizipstatic -- for minizip

In addition a var called MINIZIP_ENABLE_BZIP2 is exported so you can check if you got a bzip2 enabled
In addition a var called `MINIZIP_ENABLE_BZIP2` is exported so you can check if you got a bzip2 enabled
version of the lib. As linking against libbz2 is only needed if you use functions from that set, it's
no hard dep and you have to make sure a working bzip2-installation is found and linked in your binary.

0 comments on commit 169a528

Please sign in to comment.