Skip to content

Commit a1ff128

Browse files
committed
cmake: do not require static deps for a shared library
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).
1 parent fde3e38 commit a1ff128

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cmake/exiv2Config.cmake.in

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
cmake_minimum_required(VERSION 3.5)
44
include(CMakeFindDependencyMacro)
55

6-
if(@EXIV2_ENABLE_PNG@) # if(EXIV2_ENABLE_PNG)
7-
find_dependency(ZLIB REQUIRED)
8-
endif()
6+
if(NOT @BUILD_SHARED_LIBS@) # if(NOT BUILD_SHARED_LIBS)
7+
if(@EXIV2_ENABLE_PNG@) # if(EXIV2_ENABLE_PNG)
8+
find_dependency(ZLIB REQUIRED)
9+
endif()
910

10-
if(@EXIV2_ENABLE_XMP@) # if(EXIV2_ENABLE_XMP)
11-
find_dependency(EXPAT REQUIRED)
11+
if(@EXIV2_ENABLE_XMP@) # if(EXIV2_ENABLE_XMP)
12+
find_dependency(EXPAT REQUIRED)
13+
endif()
1214
endif()
1315

1416
include("${CMAKE_CURRENT_LIST_DIR}/exiv2Export.cmake")

0 commit comments

Comments
 (0)