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") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eb8bfc438f..06d6400432 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -288,23 +288,25 @@ if(EXIV2_ENABLE_INIH) list(APPEND requires_private_list "INIReader") endif() -# Convert private lists to delimited strings -list(SORT libs_private_list) -string(REPLACE ";" " -l" libs_private_string "${libs_private_list}") -if(libs_private_string) - string(PREPEND libs_private_string "-l") +if(NOT BUILD_SHARED_LIBS) + # Convert private lists to delimited strings + list(SORT libs_private_list) + string(REPLACE ";" " -l" libs_private_string "${libs_private_list}") + if(libs_private_string) + string(PREPEND libs_private_string "-l") + endif() + list(SORT requires_private_list) + string(REPLACE ";" ", " requires_private_string "${requires_private_list}") + + set(libs_private_for_pc_file + "${libs_private_string}" + PARENT_SCOPE + ) + set(requires_private_for_pc_file + "${requires_private_string}" + PARENT_SCOPE + ) endif() -list(SORT requires_private_list) -string(REPLACE ";" ", " requires_private_string "${requires_private_list}") - -set(libs_private_for_pc_file - "${libs_private_string}" - PARENT_SCOPE -) -set(requires_private_for_pc_file - "${requires_private_string}" - PARENT_SCOPE -) write_basic_package_version_file(exiv2ConfigVersion.cmake COMPATIBILITY ExactVersion)