Skip to content

Commit

Permalink
pkg-config: do not output static linking deps when building shared lib
Browse files Browse the repository at this point in the history
Commit 63f9926 exports the dependencies
for static linking to the pkg-config file. There are two problems with
the implementation:
- "Requires.private" in the pkg-config file makes the pkg-config
  implementation require the specified modules, 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, output the dependencies for the static linking in the pkg-config
file only when the exiv2 library build is not shared (i.e. static).
  • Loading branch information
pinotree committed Dec 27, 2023
1 parent b4f145e commit fde3e38
Showing 1 changed file with 18 additions and 16 deletions.
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

0 comments on commit fde3e38

Please sign in to comment.