| 1 |
find_path(ZLIB_NG_INCLUDE_DIR NAMES zlib-ng.h) |
| 2 |
|
| 3 |
if(ZLIB_INCLUDE_DIRS) |
| 4 |
set(ZLIB_NG_LIBRARY_DIRS ${ZLIB_NG_INCLUDE_DIR}) |
| 5 |
|
| 6 |
if("${ZLIB_NG_LIBRARY_DIRS}" MATCHES "/include$") |
| 7 |
# Strip off the trailing "/include" in the path. |
| 8 |
GET_FILENAME_COMPONENT(ZLIB_NG_LIBRARY_DIRS ${ZLIB_NG_LIBRARY_DIRS} PATH) |
| 9 |
endif("${ZLIB_NG_LIBRARY_DIRS}" MATCHES "/include$") |
| 10 |
|
| 11 |
if(EXISTS "${ZLIB_NG_LIBRARY_DIRS}/lib") |
| 12 |
set(ZLIB_NG_LIBRARY_DIRS ${ZLIB_NG_LIBRARY_DIRS}/lib) |
| 13 |
endif(EXISTS "${ZLIB_NG_LIBRARY_DIRS}/lib") |
| 14 |
endif() |
| 15 |
|
| 16 |
find_library(ZLIB_NG_LIBRARY NAMES z-ng libz-ng zlib-ng libz-ng.a) |
| 17 |
|
| 18 |
set(ZLIB_NG_LIBRARIES ${ZLIB_NG_LIBRARY}) |
| 19 |
set(ZLIB_NG_INCLUDE_DIR ${ZLIB_NG_INCLUDE_DIR}) |
| 20 |
|
| 21 |
include(FindPackageHandleStandardArgs) |
| 22 |
find_package_handle_standard_args(ZLIB_NG DEFAULT_MSG ZLIB_NG_LIBRARY ZLIB_NG_INCLUDE_DIR) |
| 23 |
|
| 24 |
if(ZLIB_NG_INCLUDE_DIR AND ZLIB_NG_LIBRARIES) |
| 25 |
set(ZLIB_NG_FOUND TRUE) |
| 26 |
else(ZLIB_NG_INCLUDE_DIR AND ZLIB_NG_LIBRARIES) |
| 27 |
set(ZLIB_NG_FOUND FALSE) |
| 28 |
endif(ZLIB_NG_INCLUDE_DIR AND ZLIB_NG_LIBRARIES) |
| 29 |
|
| 30 |
# generate CMake target |
| 31 |
if(ZLIB_NG_FOUND) |
| 32 |
message(STATUS "Found zlib-ng: ${ZLIB_NG_LIBRARIES}, ${ZLIB_NG_INCLUDE_DIR}") |
| 33 |
|
| 34 |
set(ZLIB_NG_INCLUDE_DIRS ${ZLIB_NG_INCLUDE_DIR}) |
| 35 |
|
| 36 |
if(NOT TARGET ZLIB_NG::ZLIB_NG) |
| 37 |
add_library(ZLIB_NG::ZLIB_NG UNKNOWN IMPORTED) |
| 38 |
set_target_properties(ZLIB_NG::ZLIB_NG PROPERTIES |
| 39 |
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_NG_INCLUDE_DIRS}") |
| 40 |
|
| 41 |
set_property(TARGET ZLIB_NG::ZLIB_NG APPEND PROPERTY |
| 42 |
IMPORTED_LOCATION "${ZLIB_NG_LIBRARIES}") |
| 43 |
endif() |
| 44 |
endif() |
| 45 |
|
| 46 |
#[[ |
| 47 |
Copyright https://github.com/zlib-ng/minizip-ng, 2021 |
| 48 |
|
| 49 |
Condition of use and distribution are the same as zlib: |
| 50 |
|
| 51 |
This software is provided 'as-is', without any express or implied |
| 52 |
warranty. In no event will the authors be held liable for any damages |
| 53 |
arising from the use of this software. |
| 54 |
|
| 55 |
Permission is granted to anyone to use this software for any purpose, |
| 56 |
including commercial applications, and to alter it and redistribute it |
| 57 |
freely, subject to the following restrictions: |
| 58 |
|
| 59 |
1. The origin of this software must not be misrepresented; you must not |
| 60 |
claim that you wrote the original software. If you use this software |
| 61 |
in a product, an acknowledgement in the product documentation would be |
| 62 |
appreciated but is not required. |
| 63 |
2. Altered source versions must be plainly marked as such, and must not be |
| 64 |
misrepresented as being the original software. |
| 65 |
3. This notice may not be removed or altered from any source distribution. |
| 66 |
]]# |