From a77c1d0670e3563af3c4ce3e9dd53879d76acb9b Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 20 Dec 2023 09:44:45 +0200 Subject: [PATCH] Fix libintl linkage and include directories (cmake transition fallout) We checked for libintl in the top-level CMakeLists.txt but then never used it for anything. This only ever worked on glibc where this all is bundled in. Unfortunately Intl only becomes an importable target in cmake >= 3.20 which is too new for us to rely on for now. Python bindings are omitted here because we don't have any translated messages in there. Whether we should is another topic. --- build/CMakeLists.txt | 2 ++ lib/CMakeLists.txt | 3 ++- misc/CMakeLists.txt | 1 + plugins/CMakeLists.txt | 3 ++- rpmio/CMakeLists.txt | 6 +++++- rpmio/rpmpgp_legacy/CMakeLists.txt | 1 + sign/CMakeLists.txt | 3 ++- tools/CMakeLists.txt | 2 ++ 8 files changed, 17 insertions(+), 4 deletions(-) diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 29db899306..fd5c179b0d 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -17,6 +17,7 @@ target_include_directories(librpmbuild PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/rpmio ${CMAKE_SOURCE_DIR}/lib + ${Intl_INCLUDE_DIRS} ) target_link_libraries(librpmbuild PUBLIC librpmio librpm) @@ -25,6 +26,7 @@ target_link_libraries(librpmbuild PRIVATE PkgConfig::POPT LUA::LUA MAGIC::MAGIC + ${Intl_LIBRARIES} ) if (LIBDW_FOUND) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 37ec4971cf..e1ef8e5aa8 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -16,6 +16,7 @@ target_include_directories(librpm PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/rpmio ${CMAKE_CURRENT_BINARY_DIR} + ${Intl_INCLUDE_DIRS} ) target_sources(librpm PRIVATE @@ -72,6 +73,6 @@ add_custom_command(OUTPUT tagtbl.C ) target_link_libraries(librpm PUBLIC librpmio) -target_link_libraries(librpm PRIVATE PkgConfig::POPT LUA::LUA) +target_link_libraries(librpm PRIVATE PkgConfig::POPT LUA::LUA ${Intl_LIBRARIES}) install(TARGETS librpm EXPORT rpm-targets) diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt index 64e9513542..925d2ea952 100644 --- a/misc/CMakeLists.txt +++ b/misc/CMakeLists.txt @@ -1 +1,2 @@ add_library(libmisc OBJECT fts.c rpmfts.h) +target_include_directories(libmisc PRIVATE ${Intl_INCLUDE_DIRS}) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 78d5c2d7a5..a44056fe3a 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -47,7 +47,8 @@ set(RPM_PLUGINDIR ${CMAKE_INSTALL_FULL_LIBDIR}/rpm-plugins get_property(plugins DIRECTORY PROPERTY BUILDSYSTEM_TARGETS) foreach(plugin ${plugins}) - target_link_libraries(${plugin} PRIVATE librpmio librpm) + target_link_libraries(${plugin} PRIVATE librpmio librpm ${Intl_LIBRARIES}) + target_include_directories(${plugin} PRIVATE ${Intl_INCLUDE_DIRS}) install(TARGETS ${plugin} DESTINATION ${RPM_PLUGINDIR}) install(FILES macros.transaction_${plugin} DESTINATION ${RPM_MACROSDIR}) endforeach() diff --git a/rpmio/CMakeLists.txt b/rpmio/CMakeLists.txt index f19a156c9c..d8ebf047ba 100644 --- a/rpmio/CMakeLists.txt +++ b/rpmio/CMakeLists.txt @@ -8,7 +8,10 @@ target_sources(librpmio PRIVATE rpmstrpool.c rpmmacro_internal.h rpmlua.c rpmlua.h lposix.c ) target_compile_definitions(librpmio PRIVATE RPM_CONFIGDIR="${RPM_CONFIGDIR}") -target_include_directories(librpmio PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(librpmio PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${Intl_INCLUDE_DIRS} +) if (WITH_INTERNAL_OPENPGP) add_subdirectory(rpmpgp_legacy) @@ -27,6 +30,7 @@ target_link_libraries(librpmio PRIVATE PkgConfig::POPT LUA::LUA ZLIB::ZLIB + ${Intl_LIBRARIES} ) if (ZSTD_FOUND) diff --git a/rpmio/rpmpgp_legacy/CMakeLists.txt b/rpmio/rpmpgp_legacy/CMakeLists.txt index b42c00f724..aadd079dae 100644 --- a/rpmio/rpmpgp_legacy/CMakeLists.txt +++ b/rpmio/rpmpgp_legacy/CMakeLists.txt @@ -8,6 +8,7 @@ target_sources(rpmpgp_legacy PRIVATE rpmpgp_internal.h rpmpgp_internal.c ) target_include_directories(rpmpgp_legacy PRIVATE ..) +target_include_directories(rpmpgp_legacy PRIVATE ${Intl_INCLUDE_DIRS}) if (WITH_OPENSSL) find_package(OpenSSL 3.0.0 REQUIRED) target_sources(rpmpgp_legacy PRIVATE digest_openssl.c) diff --git a/sign/CMakeLists.txt b/sign/CMakeLists.txt index c719a34040..64d865d8f7 100644 --- a/sign/CMakeLists.txt +++ b/sign/CMakeLists.txt @@ -9,10 +9,11 @@ target_include_directories(librpmsign PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/rpmio ${CMAKE_SOURCE_DIR}/lib + ${Intl_INCLUDE_DIRS} ) target_link_libraries(librpmsign PUBLIC librpmio librpm) -target_link_libraries(librpmsign PRIVATE PkgConfig::POPT) +target_link_libraries(librpmsign PRIVATE PkgConfig::POPT ${Intl_LIBRARIES}) if (WITH_IMAEVM) target_sources(librpmsign PRIVATE rpmsignfiles.c) target_link_libraries(librpmsign PRIVATE IMA::IMA) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index f4294f99ea..a53364cf45 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -47,6 +47,8 @@ endif() get_property(executables DIRECTORY PROPERTY BUILDSYSTEM_TARGETS) foreach(exe ${executables}) target_link_libraries(${exe} PRIVATE librpmio librpm PkgConfig::POPT) + target_link_libraries(${exe} PRIVATE ${Intl_LIBRARIES}) + target_include_directories(${exe} PRIVATE ${Intl_INCLUDE_DIRS}) endforeach() foreach(cmd rpmverify rpmquery)