Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion zlibConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
@PACKAGE_INIT@

set(_ZLIB_supported_components "shared" "static")
set(_ZLIB_supported_components "")

if(@ZLIB_BUILD_SHARED@)
list(APPEND _ZLIB_supported_components shared)
endif(@ZLIB_BUILD_SHARED@)

if(@ZLIB_BUILD_STATIC@)
list(APPEND _ZLIB_supported_components static)
endif(@ZLIB_BUILD_STATIC@)

if(ZLIB_FIND_COMPONENTS)
foreach(_comp ${ZLIB_FIND_COMPONENTS})
Expand All @@ -16,3 +24,9 @@ else(ZLIB_FIND_COMPONENTS)
include("${CMAKE_CURRENT_LIST_DIR}/ZLIB-${_component_config}.cmake")
endforeach(_component_config IN LISTS _ZLIB_supported_components)
endif(ZLIB_FIND_COMPONENTS)

# Compatibility: if only static was built, expose ZLIB::ZLIB and legacy vars.
if(TARGET ZLIB::ZLIBSTATIC AND NOT TARGET ZLIB::ZLIB)
add_library(ZLIB::ZLIB ALIAS ZLIB::ZLIBSTATIC)
endif()