Skip to content

Commit

Permalink
CMake: Update FindZLIB_NG For Target
Browse files Browse the repository at this point in the history
Generate an import target to bring `FindZLIB_NG.cmake` up to
par with the CMake-default shipped `FindZLIB.cmake`.
  • Loading branch information
ax3l committed Aug 18, 2023
1 parent 42ec0a7 commit fcc0313
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cmake/FindZLIB_NG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@ else(ZLIB_NG_INCLUDE_DIR AND ZLIB_NG_LIBRARIES)
set(ZLIB_NG_FOUND FALSE)
endif(ZLIB_NG_INCLUDE_DIR AND ZLIB_NG_LIBRARIES)

# generate CMake target
if(ZLIB_NG_FOUND)
message(STATUS "Found zlib-ng: ${ZLIB_NG_LIBRARIES}, ${ZLIB_NG_INCLUDE_DIR}")
endif(ZLIB_NG_FOUND)
message(STATUS "Found zlib-ng: ${ZLIB_NG_LIBRARIES}, ${ZLIB_NG_INCLUDE_DIR}")

set(ZLIB_NG_INCLUDE_DIRS ${ZLIB_NG_INCLUDE_DIR})

if(NOT TARGET ZLIB_NG::ZLIB_NG)
add_library(ZLIB_NG::ZLIB_NG UNKNOWN IMPORTED)
set_target_properties(ZLIB_NG::ZLIB_NG PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_NG_INCLUDE_DIRS}")

set_property(TARGET ZLIB_NG::ZLIB_NG APPEND PROPERTY
IMPORTED_LOCATION "${ZLIB_NG_LIBRARIES}")
endif()
endif()

#[[
Copyright https://github.com/zlib-ng/minizip-ng, 2021
Expand Down

0 comments on commit fcc0313

Please sign in to comment.