From b5c2b64307dc01128d2a90771cf51076bc1252db Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 28 Aug 2019 13:51:25 -0500 Subject: Correct threadsafe enable code --- CMakeLists.txt | 12 +++++++----- config/cmake/H5pubconf.h.in | 7 ++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a611b71..f6d55b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -684,8 +684,10 @@ endif () option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF) if (HDF5_ENABLE_THREADSAFE) # check for unsupported options - message (STATUS " **** thread-safety option not supported with static library **** ") - message (STATUS " **** thread-safety option will not be used building static library **** ") + if (WIN32 OR MINGW) + message (STATUS " **** thread-safety option not supported with static library **** ") + message (STATUS " **** thread-safety option will not be used building static library **** ") + endif () if (HDF5_ENABLE_PARALLEL) if (NOT ALLOW_UNSUPPORTED) message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ") @@ -723,9 +725,9 @@ if (HDF5_ENABLE_THREADSAFE) endif () endif () set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads) - if (NOT Threads_FOUND) - message (STATUS " **** thread-safe package not found - threads still might work **** ") + find_package(Threads REQUIRED) + if (Threads_FOUND) + set (H5_HAVE_THREADSAFE 1) endif () endif () diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 05b0fff..9ccfae4 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -390,8 +390,13 @@ /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_SZLIB_H @H5_HAVE_SZLIB_H@ +#if defined(_WIN32) && !defined(H5_BUILT_AS_DYNAMIC_LIB) +/* Not supported on WIN32 platforms with static linking */ +/* #undef H5_HAVE_THREADSAFE */ +#else /* Define if we have thread safe support */ -#cmakedefine H5_HAVE_THREADSAFE @H5_HAVE_THREADSAFE@ +# cmakedefine H5_HAVE_THREADSAFE @H5_HAVE_THREADSAFE@ +#endif /* Define if timezone is a global variable */ #cmakedefine H5_HAVE_TIMEZONE @H5_HAVE_TIMEZONE@ -- cgit v0.12