diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 141ab44..66b7efa 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -74,6 +74,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) set (H5_ZLIB_HEADER "zlib.h") set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) + set (zlib_PC_LIBS_PRIVATE "${ZLIB_LIBRARIES}") else () if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) @@ -128,8 +129,10 @@ if (HDF5_ENABLE_SZIP_SUPPORT) else() get_target_property(SZIP_STATIC_LIBRARY szip-shared IMPORTED_LOCATION_${upper_build_type}) endif() + set(szip_PC_LIBS_PRIVATE "${SZIP_STATIC_LIBRARY}") elseif (TARGET szip-static) get_target_property(SZIP_STATIC_LIBRARY szip-static IMPORTED_LOCATION_${upper_build_type}) + set(szip_PC_LIBS_PRIVATE "${SZIP_STATIC_LIBRARY}") elseif (SZIP_FOUND) set (H5_HAVE_FILTER_SZIP 1) set (H5_HAVE_SZLIB_H 1) diff --git a/CMakeLists.txt b/CMakeLists.txt index b75fdd2..a2e88fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -750,6 +750,9 @@ if (H5_HAVE_PARALLEL) if (MPI_C_LINK_FLAGS) set (CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") endif () + if(UNIX) + set(ompi-c_PC_LIBS_PRIVATE ${MPI_C_LIBRARIES}) + endif() endif () #option (DEFAULT_API_VERSION "Enable v1.12 API (v16, v18, v110, v112)" "v112") diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 835d422..9a7176f 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -188,14 +188,14 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") 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${HDF5_CPP_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") 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${HDF5_CPP_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") endif () -set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}") -set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}") +set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}") configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index ae0ebca..095fae4 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -384,7 +384,7 @@ macro (HDF_DIR_PATHS package_prefix) endif () #set the default debug suffix for all library targets - if(NOT CMAKE_DEBUG_POSTFIX) + if(NOT DEFINED CMAKE_DEBUG_POSTFIX) if (WIN32) set (CMAKE_DEBUG_POSTFIX "_D") else () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index e59a829..8da64dd 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -545,14 +545,14 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") 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${HDF5_F90_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") 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${HDF5_F90_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") endif () -set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}") -set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}") +set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}") configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index c516df1..89bd31f 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -99,14 +99,14 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") 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${HDF5_HL_CPP_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") 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${HDF5_HL_CPP_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") endif () -set (_PKG_CONFIG_REQUIRES "${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}") -set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}") +set (_PKG_CONFIG_REQUIRES "${HDF5_HL_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_HL_LIB_CORENAME}") configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 973299f..8eadfe5 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -332,14 +332,14 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") 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${HDF5_HL_F90_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") 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${HDF5_HL_F90_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") endif () -set (_PKG_CONFIG_REQUIRES "${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}") -set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}") +set (_PKG_CONFIG_REQUIRES "${HDF5_F90_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_F90_LIB_CORENAME}") configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 7678de8..2d398cc 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -131,14 +131,14 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") 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${HDF5_HL_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") 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${HDF5_HL_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") endif () -set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}") -set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}") +set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}") configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b3c2226..ea80d60 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1321,14 +1321,23 @@ foreach (libs ${LINK_LIBS} ${LINK_COMP_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${HDF5_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") 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${HDF5_LIB_CORENAME}${CMAKE_DEBUG_POSTFIX}") endif () set (_PKG_CONFIG_REQUIRES) set (_PKG_CONFIG_REQUIRES_PRIVATE) +set(_PKG_CONFIG_LIBS_PRIVATE " ${_PKG_CONFIG_LIBS_PRIVATE} ") +foreach(_module IN ITEMS ompi-c szip zlib) + if(${_module}_PC_LIBS_PRIVATE) + foreach(_lib IN LISTS ${_module}_PC_LIBS_PRIVATE) + string(REPLACE " -l${_lib} " " " _PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE}") + endforeach() + string(APPEND _PKG_CONFIG_REQUIRES_PRIVATE " ${_module}") + endif() +endforeach() configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in