Skip to content

Commit

Permalink
cmake: do not require static deps for a shared library
Browse files Browse the repository at this point in the history
Commit a8c3455,
commit 5e1cf4d, and
commit 4dfb781 implement & add the
libraries needed in case of static linking as dependencies for the cmake
config file. There are two problems with the implementation:
- being unconditionally there, they will make those modules required
  when building against exiv2, even when not building statically
- the exiv2 library build is done either shared or static, so there is
  no static library in case of a shared build

Hence, require the dependencies for the static linking in the cmake
config file only when the exiv2 library build is not shared (i.e.
static).
  • Loading branch information
pinotree committed Dec 27, 2023
1 parent fde3e38 commit a1ff128
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmake/exiv2Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit a1ff128

Please sign in to comment.