1 cmake_minimum_required (VERSION 3.1)
2 project(zzipbins VERSION "0.13.71" LANGUAGES C)
4 if(NOT CMAKE_BUILD_TYPE)
5 set(CMAKE_BUILD_TYPE Release)
6 endif(NOT CMAKE_BUILD_TYPE)
8 include ( GNUInstallDirs )
9 include ( FindPkgConfig )
11 # options ########################################################
12 option(BUILD_SHARED_LIBS "Build a shared library" ON)
13 option(BUILD_STATIC_LIBS "Build the static library" OFF)
14 option(BUILD_TESTS "Build test programs" OFF)
15 option(MSVC_STATIC_RUNTIME "Build with static runtime libs (/MT)" ON)
17 option(ZZIP_INSTALL_BINS "Install the bins/ exanple programs" ON)
18 option(ZZIP_INSTALL_ACLOCAL "Install zziplib.m4 aclocal helper" ON)
21 find_package ( ZLIB REQUIRED )
22 # pkg_search_module ( ZZIP zzip )
23 # pkg_search_module ( ZZIPMAPPED zzipmmapped )
24 # pkg_search_module ( ZZIPFSEEKO zzipfseeko )
26 # targets ########################################################
27 add_executable(zzcat zzcat.c)
28 add_executable(zzdir zzdir.c)
29 add_executable(zzxorcat zzxorcat.c)
30 add_executable(zzxordir zzxordir.c)
31 add_executable(zzxorcopy zzxorcopy.c)
32 add_executable(zzobfuscated zzobfuscated.c)
33 add_executable(zziptest zziptest.c)
34 add_executable(zzip zzip.c zzipmake-zip.c)
35 add_executable(unzzip unzzip.c unzzipcat-zip.c unzzipdir-zip.c)
36 add_executable(unzzip-mix unzzip.c unzzipcat-mix.c unzzipdir-mix.c)
37 add_executable(unzzip-big unzzip.c unzzipcat-big.c unzzipdir-big.c)
38 add_executable(unzzip-mem unzzip.c unzzipcat-mem.c unzzipdir-mem.c)
39 add_executable(unzip-mem unzip-mem.c)
41 target_link_libraries(zzcat libzzip ZLIB::ZLIB)
42 target_link_libraries(zzdir libzzip ZLIB::ZLIB)
43 target_link_libraries(zzxorcat libzzip ZLIB::ZLIB)
44 target_link_libraries(zzxordir libzzip ZLIB::ZLIB)
45 target_link_libraries(zzxorcopy libzzip ZLIB::ZLIB)
46 target_link_libraries(zzobfuscated libzzip ZLIB::ZLIB)
47 target_link_libraries(zziptest libzzip ZLIB::ZLIB)
48 target_link_libraries(zzip libzzip ZLIB::ZLIB)
49 target_link_libraries(unzzip libzzip ZLIB::ZLIB)
50 target_link_libraries(unzzip-mix libzzip ZLIB::ZLIB)
51 target_link_libraries(unzzip-big libzzipfseeko ZLIB::ZLIB)
52 target_link_libraries(unzzip-mem libzzipmmapped ZLIB::ZLIB)
53 target_link_libraries(unzip-mem libzzipmmapped ZLIB::ZLIB)
55 target_include_directories(zzcat PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
56 target_include_directories(zzdir PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
57 target_include_directories(zzxorcat PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
58 target_include_directories(zzxordir PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
59 target_include_directories(zzxorcopy PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
60 target_include_directories(zzobfuscated PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
61 target_include_directories(zziptest PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
62 target_include_directories(zzip PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
63 target_include_directories(unzzip PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
64 target_include_directories(unzzip-mix PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
65 target_include_directories(unzzip-big PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
66 target_include_directories(unzzip-mem PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
67 target_include_directories(unzip-mem PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
69 # install ########################################################
71 install(TARGETS zzcat zzdir zzxorcat zzxordir zzxorcopy
72 unzzip unzzip-mix unzzip-big unzzip-mem unzip-mem
73 DESTINATION "${CMAKE_INSTALL_BINDIR}")
76 if(ZZIP_INSTALL_ACLOCAL)
77 install(FILES zziplib.m4
78 DESTINATION "${CMAKE_INSTALL_DATADIR}/aclocal")