Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not require dependencies for static linking when exiv2 was built as shared #2872

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
34 changes: 18 additions & 16 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down