Skip to content

Commit 99c307f

Browse files
pinotreekmilos
authored andcommitted
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 710f8e6 commit 99c307f

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

cmake/exiv2Config.cmake.in

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
@PACKAGE_INIT@
22

3-
cmake_minimum_required(VERSION 3.5)
3+
cmake_minimum_required(VERSION 3.12)
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_WEBREADY@) # if(EXIV2_ENABLE_WEBREADY)
11-
if(@EXIV2_ENABLE_CURL@) # if(EXIV2_ENABLE_CURL)
12-
find_dependency(CURL REQUIRED)
11+
if(@EXIV2_ENABLE_WEBREADY@) # if(EXIV2_ENABLE_WEBREADY)
12+
if(@EXIV2_ENABLE_CURL@) # if(EXIV2_ENABLE_CURL)
13+
find_dependency(CURL REQUIRED)
14+
endif()
1315
endif()
14-
endif()
1516

16-
if(@EXIV2_ENABLE_XMP@) # if(EXIV2_ENABLE_XMP)
17-
find_dependency(EXPAT REQUIRED)
18-
endif()
17+
if(@EXIV2_ENABLE_XMP@) # if(EXIV2_ENABLE_XMP)
18+
find_dependency(EXPAT REQUIRED)
19+
endif()
1920

20-
if(@EXIV2_ENABLE_NLS@) # if(EXIV2_ENABLE_NLS)
21+
if(@EXIV2_ENABLE_NLS@) # if(EXIV2_ENABLE_NLS)
2122
find_dependency(Intl REQUIRED)
22-
endif()
23+
endif()
2324

24-
if(@EXV_HAVE_LIBICONV@) # if(EXV_HAVE_LIBICONV)
25+
if(@EXV_HAVE_LIBICONV@) # if(EXV_HAVE_LIBICONV)
2526
find_dependency(Iconv REQUIRED)
27+
endif()
2628
endif()
2729

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

0 commit comments

Comments
 (0)