From 2f7c1d8a7f293c570acf8a30a712139dbb7319ff Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 7 Aug 2024 14:10:09 -0500 Subject: [PATCH 1/5] Add Windows SHLWAPI lib to public interface --- config/cmake/ConfigureChecks.cmake | 2 +- src/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 589cf83c746..eef45c3810f 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -127,7 +127,7 @@ CHECK_INCLUDE_FILE_CONCAT ("arpa/inet.h" ${HDF_PREFIX}_HAVE_ARPA_INET_H) if (WINDOWS) CHECK_INCLUDE_FILE_CONCAT ("shlwapi.h" ${HDF_PREFIX}_HAVE_SHLWAPI_H) # Checking for StrStrIA in the library is not reliable for mingw32 to stdcall - set (LINK_LIBS ${LINK_LIBS} "shlwapi") + set (SHLWAPI_LIB "shlwapi") endif () ## Check for non-standard extension quadmath.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4a13c5a47ca..2e77417df83 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1099,7 +1099,7 @@ if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} - PUBLIC "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" + PUBLIC "$" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" ) if (NOT WIN32) target_link_libraries (${HDF5_LIB_TARGET} @@ -1135,7 +1135,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} - PUBLIC "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" "$<$,$>:Threads::Threads>" + PUBLIC "$" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" "$<$,$>:Threads::Threads>" ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") From 7bce8ed3e3c0c2ca58ba7644f73ba692274c6b91 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 7 Aug 2024 14:37:04 -0500 Subject: [PATCH 2/5] Correct syntax --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e77417df83..e0ab457cf2f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1099,7 +1099,7 @@ if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} - PUBLIC "$" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" + PUBLIC "$<$:${SHLWAPI_LIB}>" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" ) if (NOT WIN32) target_link_libraries (${HDF5_LIB_TARGET} @@ -1135,7 +1135,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} - PUBLIC "$" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" "$<$,$>:Threads::Threads>" + PUBLIC "$<$:${SHLWAPI_LIB}>" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" "$<$,$>:Threads::Threads>" ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") From 4f66fbc63bfbb58ee01307d117ab1b35328f8097 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 7 Aug 2024 15:13:49 -0500 Subject: [PATCH 3/5] Change shlwapi dependency to INTERFACE from PUBLIC --- src/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e0ab457cf2f..07490507039 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1099,7 +1099,8 @@ if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} - PUBLIC "$<$:${SHLWAPI_LIB}>" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" + INTERFACE "$<$:${SHLWAPI_LIB}>" + PUBLIC "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" ) if (NOT WIN32) target_link_libraries (${HDF5_LIB_TARGET} @@ -1135,7 +1136,8 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} - PUBLIC "$<$:${SHLWAPI_LIB}>" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" "$<$,$>:Threads::Threads>" + INTERFACE "$<$:${SHLWAPI_LIB}>" + PUBLIC "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" "$<$,$>:Threads::Threads>" ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") From 582147c91073064f09274e50a2aed81bd7cf2c13 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 7 Aug 2024 16:47:21 -0500 Subject: [PATCH 4/5] REVERT shlwapi lib back to PUBLIC link --- src/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 07490507039..e0ab457cf2f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1099,8 +1099,7 @@ if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} - INTERFACE "$<$:${SHLWAPI_LIB}>" - PUBLIC "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" + PUBLIC "$<$:${SHLWAPI_LIB}>" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" ) if (NOT WIN32) target_link_libraries (${HDF5_LIB_TARGET} @@ -1136,8 +1135,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} - INTERFACE "$<$:${SHLWAPI_LIB}>" - PUBLIC "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" "$<$,$>:Threads::Threads>" + PUBLIC "$<$:${SHLWAPI_LIB}>" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" "$<$,$>:Threads::Threads>" ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") From 2bf87f3a0e9d1e25e3bbb121a8994600d4fe9bff Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 8 Aug 2024 12:42:47 -0500 Subject: [PATCH 5/5] Change name of variable --- config/cmake/ConfigureChecks.cmake | 3 ++- src/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index eef45c3810f..6db82bb9229 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -39,6 +39,7 @@ endif () # does, it appends library to the list. #----------------------------------------------------------------------------- set (LINK_LIBS "") +set (LINK_PUB_LIBS "") macro (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) CHECK_LIBRARY_EXISTS ("${LIBRARY};${LINK_LIBS}" ${SYMBOL} "" ${VARIABLE}) if (${VARIABLE}) @@ -127,7 +128,7 @@ CHECK_INCLUDE_FILE_CONCAT ("arpa/inet.h" ${HDF_PREFIX}_HAVE_ARPA_INET_H) if (WINDOWS) CHECK_INCLUDE_FILE_CONCAT ("shlwapi.h" ${HDF_PREFIX}_HAVE_SHLWAPI_H) # Checking for StrStrIA in the library is not reliable for mingw32 to stdcall - set (SHLWAPI_LIB "shlwapi") + set (LINK_PUB_LIBS ${LINK_PUB_LIBS} "shlwapi") endif () ## Check for non-standard extension quadmath.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e0ab457cf2f..2fadc0e039a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1099,7 +1099,7 @@ if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} - PUBLIC "$<$:${SHLWAPI_LIB}>" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" + PUBLIC "$<$:${LINK_PUB_LIBS}>" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" ) if (NOT WIN32) target_link_libraries (${HDF5_LIB_TARGET} @@ -1135,7 +1135,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} - PUBLIC "$<$:${SHLWAPI_LIB}>" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" "$<$,$>:Threads::Threads>" + PUBLIC "$<$:${LINK_PUB_LIBS}>" "$<$>:${CMAKE_DL_LIBS}>" "$<$:MPI::MPI_C>" "$<$,$>:Threads::Threads>" ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB")