diff --git a/cmake/exiv2Config.cmake.in b/cmake/exiv2Config.cmake.in index c9e2eba9b5..8ea7f726b0 100644 --- a/cmake/exiv2Config.cmake.in +++ b/cmake/exiv2Config.cmake.in @@ -3,12 +3,14 @@ cmake_minimum_required(VERSION 3.5) include(CMakeFindDependencyMacro) -if(@EXIV2_ENABLE_PNG@) # if(EXIV2_ENABLE_PNG) - find_dependency(ZLIB REQUIRED) -endif() +if(NOT @BUILD_SHARED_LIBS@) # if(NOT BUILD_SHARED_LIBS) + if(@EXIV2_ENABLE_PNG@) # if(EXIV2_ENABLE_PNG) + find_dependency(ZLIB REQUIRED) + endif() -if(@EXIV2_ENABLE_XMP@) # if(EXIV2_ENABLE_XMP) - find_dependency(EXPAT REQUIRED) + if(@EXIV2_ENABLE_XMP@) # if(EXIV2_ENABLE_XMP) + find_dependency(EXPAT REQUIRED) + endif() endif() include("${CMAKE_CURRENT_LIST_DIR}/exiv2Export.cmake")