summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kittisopikul <mkitti@users.noreply.github.com>2023-01-17 15:27:25 (GMT)
committerGitHub <noreply@github.com>2023-01-17 15:27:25 (GMT)
commit720e04e196aac60b8914830b0297fdf291cb7f00 (patch)
treede1e7dec652e3805fcdbe18ee76359fe2cddad20
parent5543d6eb36bbb32ede0598b0f36641933368f90f (diff)
downloadhdf5-720e04e196aac60b8914830b0297fdf291cb7f00.zip
hdf5-720e04e196aac60b8914830b0297fdf291cb7f00.tar.gz
hdf5-720e04e196aac60b8914830b0297fdf291cb7f00.tar.bz2
Include shlwapi.h explicitly on Windows (#2407)
* Include shlwapi.h explicitly * Add shlwapi library to LINK_LIB when header is detected Looking for StrStrIA in the shlwapi library is not reliable due to stdcall on mingw32.
-rw-r--r--config/cmake/ConfigureChecks.cmake6
-rw-r--r--src/H5private.h1
2 files changed, 3 insertions, 4 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index ef434b3..70a2104 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -131,6 +131,8 @@ CHECK_INCLUDE_FILE_CONCAT ("netdb.h" ${HDF_PREFIX}_HAVE_NETDB_H)
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 relaible for mingw32 to stdcall
+ set (LINK_LIBS ${LINK_LIBS} "shlwapi")
endif ()
## Check for non-standard extension quadmath.h
@@ -156,10 +158,6 @@ if (MINGW OR NOT WINDOWS)
CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname ${HDF_PREFIX}_HAVE_LIBWSOCK32)
endif ()
-if (WINDOWS)
- CHECK_LIBRARY_EXISTS_CONCAT ("shlwapi" StrStrIA ${HDF_PREFIX}_HAVE_SHLWAPI)
-endif ()
-
# UCB (BSD) compatibility library
CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname ${HDF_PREFIX}_HAVE_LIBUCB)
diff --git a/src/H5private.h b/src/H5private.h
index 0b68305..6ed0aa2 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -125,6 +125,7 @@
#include <direct.h> /* For _getcwd() */
#include <io.h> /* POSIX I/O */
#include <winsock2.h> /* For GetUserName() */
+#include <shlwapi.h> /* For StrStrIA */
#ifdef H5_HAVE_THREADSAFE
#include <process.h> /* For _beginthread() */