From 593484fa0ee30e42a7b735e6a08744b736885d11 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 17 Feb 2023 16:17:58 -0600 Subject: 1.12 Merge Correct pkgconfig variables and libraries #2259 (#2478) * Merge Correct pkgconfig variables and libraries #2259 * Fix spacing --- c++/src/CMakeLists.txt | 8 ++++++-- config/libhdf5.fpc.in | 2 +- config/libhdf5.pc.in | 2 +- fortran/src/CMakeLists.txt | 8 ++++++-- hl/c++/src/CMakeLists.txt | 8 ++++++-- hl/fortran/src/CMakeLists.txt | 8 ++++++-- hl/src/CMakeLists.txt | 8 ++++++-- release_docs/RELEASE.txt | 13 +++++++++++++ src/CMakeLists.txt | 18 ++++++++++++++---- 9 files changed, 59 insertions(+), 16 deletions(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index afb1c9f..b437457 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -177,14 +177,18 @@ set (_PKG_CONFIG_LIBDIR \${exec_prefix}/${HDF5_INSTALL_LIB_DIR}) set (_PKG_CONFIG_INCLUDEDIR \${prefix}/${HDF5_INSTALL_INCLUDE_DIR}) set (_PKG_CONFIG_LIBNAME "${HDF5_CPP_LIB_CORENAME}") set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") +set (PKG_CONFIG_LIBNAME "${HDF5_CPP_LIB_CORENAME}") +if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") + set (PKG_CONFIG_LIBNAME "${PKG_CONFIG_LIBNAME}${CMAKE_DEBUG_POSTFIX}") +endif () set (_PKG_CONFIG_LIBS_PRIVATE) if (NOT ONLY_SHARED_LIBS) - set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}") + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${PKG_CONFIG_LIBNAME}") endif () if (BUILD_SHARED_LIBS) - set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_CPP_LIB_CORENAME}") + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${PKG_CONFIG_LIBNAME}") endif () set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME} = ${HDF5_PACKAGE_VERSION}") diff --git a/config/libhdf5.fpc.in b/config/libhdf5.fpc.in index c28c2f9..d4ac615 100644 --- a/config/libhdf5.fpc.in +++ b/config/libhdf5.fpc.in @@ -12,5 +12,5 @@ Cflags: -I${includedir} Fflags: -I${moddir} Libs: -L${libdir} @_PKG_CONFIG_SH_LIBS@ Requires: @_PKG_CONFIG_REQUIRES@ -Libs.private: @_PKG_CONFIG_LIBS_PRIVATE@ @_PKG_CONFIG_LIBS@ +Libs.private: @_PKG_CONFIG_LIBS@ @_PKG_CONFIG_LIBS_PRIVATE@ Requires.private: @_PKG_CONFIG_REQUIRES_PRIVATE@ diff --git a/config/libhdf5.pc.in b/config/libhdf5.pc.in index 4a2ebaa..3cb42d2 100644 --- a/config/libhdf5.pc.in +++ b/config/libhdf5.pc.in @@ -10,5 +10,5 @@ Version: @_PKG_CONFIG_VERSION@ Cflags: -I${includedir} Libs: -L${libdir} @_PKG_CONFIG_SH_LIBS@ Requires: @_PKG_CONFIG_REQUIRES@ -Libs.private: @_PKG_CONFIG_LIBS_PRIVATE@ @_PKG_CONFIG_LIBS@ +Libs.private: @_PKG_CONFIG_LIBS@ @_PKG_CONFIG_LIBS_PRIVATE@ Requires.private: @_PKG_CONFIG_REQUIRES_PRIVATE@ diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 409af0e..b763883 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -542,14 +542,18 @@ set (_PKG_CONFIG_INCLUDEDIR \${prefix}/${HDF5_INSTALL_INCLUDE_DIR}) set (_PKG_CONFIG_MODULEDIR \${prefix}/${HDF5_INSTALL_MODULE_DIR}) set (_PKG_CONFIG_LIBNAME "${HDF5_F90_LIB_CORENAME}") set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") +set (PKG_CONFIG_LIBNAME "${HDF5_F90_LIB_CORENAME}") +if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") + set (PKG_CONFIG_LIBNAME "${PKG_CONFIG_LIBNAME}${CMAKE_DEBUG_POSTFIX}") +endif () set (_PKG_CONFIG_LIBS_PRIVATE) if (NOT ONLY_SHARED_LIBS) - set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_F90_LIB_CORENAME}") + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${PKG_CONFIG_LIBNAME}") endif () if (BUILD_SHARED_LIBS) - set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_F90_LIB_CORENAME}") + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${PKG_CONFIG_LIBNAME}") endif () set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME} = ${HDF5_PACKAGE_VERSION}") diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index ab09d74..2483dd4 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -95,14 +95,18 @@ set (_PKG_CONFIG_LIBDIR \${exec_prefix}/${HDF5_INSTALL_LIB_DIR}) set (_PKG_CONFIG_INCLUDEDIR \${prefix}/${HDF5_INSTALL_INCLUDE_DIR}) set (_PKG_CONFIG_LIBNAME "${HDF5_HL_CPP_LIB_CORENAME}") set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") +set (PKG_CONFIG_LIBNAME "${HDF5_HL_CPP_LIB_CORENAME}") +if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") + set (PKG_CONFIG_LIBNAME "${PKG_CONFIG_LIBNAME}${CMAKE_DEBUG_POSTFIX}") +endif () set (_PKG_CONFIG_LIBS_PRIVATE) if (NOT ONLY_SHARED_LIBS) - set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}") + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${PKG_CONFIG_LIBNAME}") endif () if (BUILD_SHARED_LIBS) - set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}") + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${PKG_CONFIG_LIBNAME}") endif () set (_PKG_CONFIG_REQUIRES "${HDF5_HL_LIB_CORENAME} = ${HDF5_PACKAGE_VERSION}") diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index ad462ea..f218b13 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -329,14 +329,18 @@ set (_PKG_CONFIG_INCLUDEDIR \${prefix}/${HDF5_INSTALL_INCLUDE_DIR}) set (_PKG_CONFIG_MODULEDIR \${prefix}/${HDF5_INSTALL_MODULE_DIR}) set (_PKG_CONFIG_LIBNAME "${HDF5_HL_F90_LIB_CORENAME}") set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") +set (PKG_CONFIG_LIBNAME "${HDF5_HL_F90_LIB_CORENAME}") +if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") + set (PKG_CONFIG_LIBNAME "${PKG_CONFIG_LIBNAME}${CMAKE_DEBUG_POSTFIX}") +endif () set (_PKG_CONFIG_LIBS_PRIVATE) if (NOT ONLY_SHARED_LIBS) - set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_F90_LIB_CORENAME}") + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${PKG_CONFIG_LIBNAME}") endif () if (BUILD_SHARED_LIBS) - set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_F90_LIB_CORENAME}") + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${PKG_CONFIG_LIBNAME}") endif () set (_PKG_CONFIG_REQUIRES "${HDF5_F90_LIB_CORENAME} = ${HDF5_PACKAGE_VERSION}") diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 6dd5be7..f52faf6 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -127,14 +127,18 @@ set (_PKG_CONFIG_LIBDIR \${exec_prefix}/${HDF5_INSTALL_LIB_DIR}) set (_PKG_CONFIG_INCLUDEDIR \${prefix}/${HDF5_INSTALL_INCLUDE_DIR}) set (_PKG_CONFIG_LIBNAME "${HDF5_HL_LIB_CORENAME}") set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") +set (PKG_CONFIG_LIBNAME "${HDF5_HL_LIB_CORENAME}") +if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") + set (PKG_CONFIG_LIBNAME "${PKG_CONFIG_LIBNAME}${CMAKE_DEBUG_POSTFIX}") +endif () set (_PKG_CONFIG_LIBS_PRIVATE) if (NOT ONLY_SHARED_LIBS) - set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_LIB_CORENAME}") + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${PKG_CONFIG_LIBNAME}") endif () if (BUILD_SHARED_LIBS) - set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_LIB_CORENAME}") + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${PKG_CONFIG_LIBNAME}") endif () set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME} = ${HDF5_PACKAGE_VERSION}") diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 022010c..3226165 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -248,6 +248,19 @@ Bug Fixes since HDF5-1.12.1 release Configuration ------------- + - Correct the CMake generated pkg-config file + + The pkg-config file generated by CMake had the order and placement of the + libraries wrong. Also added support for debug library names. + + Changed the order of Libs.private libraries so that dependencies come after + dependents. Did not move the compression libraries into Requires.private + because there was not a way to determine if the compression libraries had + supported pkconfig files. Still recommend that the CMake config file method + be used for building projects with CMake. + + (ADB - 2023/02/16 GH-1546,GH-2259) + - Change the settings of the *pc files to use the correct format The pkg-config files generated by CMake uses incorrect syntax for the 'Requires' diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c6294c4..e74cbb1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1292,20 +1292,30 @@ set (_PKG_CONFIG_LIBDIR \${exec_prefix}/${HDF5_INSTALL_LIB_DIR}) set (_PKG_CONFIG_INCLUDEDIR \${prefix}/${HDF5_INSTALL_INCLUDE_DIR}) set (_PKG_CONFIG_LIBNAME "${HDF5_LIB_CORENAME}") set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") +set (PKGCONFIG_LIBNAME "${HDF5_LIB_CORENAME}") +if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") + set (PKGCONFIG_LIBNAME "${PKGCONFIG_LIBNAME}${CMAKE_DEBUG_POSTFIX}") +endif () + +foreach (libs ${LINK_LIBS}) + set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") +endforeach () -foreach (libs ${LINK_LIBS} ${LINK_COMP_LIBS}) +# The settings for the compression libs depends on if they have pkconfig support +# Assuming they don't +foreach (libs ${LINK_COMP_LIBS}) +# set (_PKG_CONFIG_REQUIRES_PRIVATE "${_PKG_CONFIG_REQUIRES_PRIVATE} -l${libs}") set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") endforeach () if (NOT ONLY_SHARED_LIBS) - set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_LIB_CORENAME}") + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${PKGCONFIG_LIBNAME}") endif () if (BUILD_SHARED_LIBS) - set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_LIB_CORENAME}") + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${PKGCONFIG_LIBNAME}") endif () set (_PKG_CONFIG_REQUIRES) -set (_PKG_CONFIG_REQUIRES_PRIVATE) configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in -- cgit v0.12