56 lines
2.2 KiB
CMake
56 lines
2.2 KiB
CMake
set(_MINIZIP_supported_components "shared" "static")
|
|
include(CMakeFindDependencyMacro)
|
|
|
|
set(minizip_HAS_BZIP2
|
|
@MINIZIP_ENABLE_BZIP2@
|
|
CACHE
|
|
Bool
|
|
"Indicates if minizip was compiled with bzip2 support")
|
|
|
|
if(minizip_HAS_BZIP2)
|
|
find_dependency(BZip2)
|
|
endif(minizip_HAS_BZIP2)
|
|
|
|
if(minizip_FIND_COMPONENTS)
|
|
find_dependency(ZLIB CONFIG COMPONENTS ${minizip_FIND_COMPONENTS})
|
|
|
|
foreach(_comp ${minizip_FIND_COMPONENTS})
|
|
if(NOT _comp IN_LIST _MINIZIP_supported_components)
|
|
set(minizip_FOUND False)
|
|
set(minizip_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
|
|
endif(NOT _comp IN_LIST _MINIZIP_supported_components)
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_comp}.cmake"
|
|
OPTIONAL
|
|
RESULT_VARIABLE _comp_loaded)
|
|
|
|
if(NOT _comp_loaded)
|
|
set(minizip_FOUND False)
|
|
set(minizip_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
|
|
else(NOT _comp_loaded)
|
|
set(minizip_${_comp}_FOUND TRUE)
|
|
endif(NOT _comp_loaded)
|
|
endforeach(_comp ${minizip_FIND_COMPONENTS})
|
|
else(minizip_FIND_COMPONENTS)
|
|
find_dependency(ZLIB CONFIG)
|
|
|
|
foreach(_component_config IN LISTS _MINIZIP_supported_components)
|
|
include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_component_config}.cmake"
|
|
OPTIONAL)
|
|
endforeach(_component_config IN LISTS _MINIZIP_supported_components)
|
|
|
|
if(NOT TARGET MINIZIP::minizip)
|
|
set(minizip_FOUND False)
|
|
set(minizip_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
|
|
string(APPEND minizip_NOT_FOUND_MESSAGE "build minizip with support for shared libs or\n")
|
|
string(APPEND minizip_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
|
|
endif(NOT TARGET ZLIB::ZLIB)
|
|
|
|
if(NOT TARGET MINIZIP::minizipstatic)
|
|
set(minizip_FOUND False)
|
|
set(minizip_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
|
|
string(APPEND minizip_NOT_FOUND_MESSAGE "build minizip with support for static libs or\n")
|
|
string(APPEND minizip_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
|
|
endif(NOT TARGET ZLIB::ZLIBSTATIC)
|
|
endif(minizip_FIND_COMPONENTS)
|