From b9be10d99e8f70afb8acae6cdc7f99a6ddc47451 Mon Sep 17 00:00:00 2001 From: Jaroslav Rohel Date: Tue, 21 May 2024 07:15:47 +0200 Subject: [PATCH] Do not export symbols from private "/common/utils" Libraries and applications (libdnf5.so, dnf5, dnf5daemon-client...) use (and statically link) private utilities from "/common/utils". And they also publicly export the symbols of these private utilities. This modification hides the symbols of utilities linked from "/common/utils". --- common/CMakeLists.txt | 1 + libdnf5-cli/CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index a3f0de058..d2db89030 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -4,6 +4,7 @@ include_directories(.) add_library(common OBJECT ${COMMON_SOURCES}) set_property(TARGET common PROPERTY POSITION_INDEPENDENT_CODE ON) +set_target_properties(common PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden) # required by clang target_link_libraries(common PUBLIC stdc++) diff --git a/libdnf5-cli/CMakeLists.txt b/libdnf5-cli/CMakeLists.txt index 0874fcf5b..2367fc406 100644 --- a/libdnf5-cli/CMakeLists.txt +++ b/libdnf5-cli/CMakeLists.txt @@ -33,6 +33,8 @@ install(TARGETS libdnf5-cli LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) # link libraries and set pkg-config requires +target_link_libraries(libdnf5-cli PRIVATE common) + target_link_libraries(libdnf5-cli PUBLIC libdnf5) pkg_check_modules(LIBFMT REQUIRED fmt)