summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt93
-rw-r--r--src/CMakeLists.txt1
2 files changed, 48 insertions, 46 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33c8ddf..65124ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -535,53 +535,54 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
#-----------------------------------------------------------------------------
# Option to use threadsafe
-# Note: Currently CMake only allows configuring of threadsafe on
-# non-Cygwin WINDOWS.
#-----------------------------------------------------------------------------
-if (WIN32)
- 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 (HDF5_ENABLE_PARALLEL)
- if (NOT ALLOW_UNSUPPORTED)
- message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ")
- else (NOT ALLOW_UNSUPPORTED)
- message (STATUS " **** Allowing unsupported parallel and thread-safety options **** ")
- endif (NOT ALLOW_UNSUPPORTED)
- endif (HDF5_ENABLE_PARALLEL)
- if (HDF5_BUILD_FORTRAN)
- if (NOT ALLOW_UNSUPPORTED)
- message (FATAL_ERROR " **** Fortran and thread-safety options are not supported **** ")
- else (NOT ALLOW_UNSUPPORTED)
- message (STATUS " **** Allowing unsupported Fortran and thread-safety options **** ")
- endif (NOT ALLOW_UNSUPPORTED)
- endif (HDF5_BUILD_FORTRAN)
- if (HDF5_BUILD_CPP_LIB)
- if (NOT ALLOW_UNSUPPORTED)
- message (FATAL_ERROR " **** C++ and thread-safety options are not supported **** ")
- else (NOT ALLOW_UNSUPPORTED)
- message (STATUS " **** Allowing unsupported C++ and thread-safety options **** ")
- endif (NOT ALLOW_UNSUPPORTED)
- endif (HDF5_BUILD_CPP_LIB)
- if (HDF5_BUILD_HL_LIB)
- if (NOT ALLOW_UNSUPPORTED)
- message (FATAL_ERROR " **** HL and thread-safety options are not supported **** ")
- else (NOT ALLOW_UNSUPPORTED)
- message (STATUS " **** Allowing unsupported HL and thread-safety options **** ")
- endif (NOT ALLOW_UNSUPPORTED)
- endif (HDF5_BUILD_HL_LIB)
- if (H5_HAVE_IOEO)
- message (STATUS " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** ")
- set (H5_HAVE_WIN_THREADS 1)
- else (H5_HAVE_IOEO)
- if (NOT H5_HAVE_PTHREAD_H)
- message (FATAL_ERROR " **** thread-safe option requires Win32 threads or Pthreads **** ")
- endif (NOT H5_HAVE_PTHREAD_H)
- endif (H5_HAVE_IOEO)
- endif (HDF5_ENABLE_THREADSAFE)
-endif (WIN32)
+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 (HDF5_ENABLE_PARALLEL)
+ if (NOT ALLOW_UNSUPPORTED)
+ message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ")
+ else (NOT ALLOW_UNSUPPORTED)
+ message (STATUS " **** Allowing unsupported parallel and thread-safety options **** ")
+ endif (NOT ALLOW_UNSUPPORTED)
+ endif (HDF5_ENABLE_PARALLEL)
+ if (HDF5_BUILD_FORTRAN)
+ if (NOT ALLOW_UNSUPPORTED)
+ message (FATAL_ERROR " **** Fortran and thread-safety options are not supported **** ")
+ else (NOT ALLOW_UNSUPPORTED)
+ message (STATUS " **** Allowing unsupported Fortran and thread-safety options **** ")
+ endif (NOT ALLOW_UNSUPPORTED)
+ endif (HDF5_BUILD_FORTRAN)
+ if (HDF5_BUILD_CPP_LIB)
+ if (NOT ALLOW_UNSUPPORTED)
+ message (FATAL_ERROR " **** C++ and thread-safety options are not supported **** ")
+ else (NOT ALLOW_UNSUPPORTED)
+ message (STATUS " **** Allowing unsupported C++ and thread-safety options **** ")
+ endif (NOT ALLOW_UNSUPPORTED)
+ endif (HDF5_BUILD_CPP_LIB)
+ if (HDF5_BUILD_HL_LIB)
+ if (NOT ALLOW_UNSUPPORTED)
+ message (FATAL_ERROR " **** HL and thread-safety options are not supported **** ")
+ else (NOT ALLOW_UNSUPPORTED)
+ message (STATUS " **** Allowing unsupported HL and thread-safety options **** ")
+ endif (NOT ALLOW_UNSUPPORTED)
+ endif (HDF5_BUILD_HL_LIB)
+ if (H5_HAVE_IOEO)
+ message (STATUS " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** ")
+ set (H5_HAVE_WIN_THREADS 1)
+ else (H5_HAVE_IOEO)
+ if (NOT H5_HAVE_PTHREAD_H)
+ message (FATAL_ERROR " **** thread-safe option requires Win32 threads or Pthreads **** ")
+ endif (NOT H5_HAVE_PTHREAD_H)
+ endif (H5_HAVE_IOEO)
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ find_package(Threads)
+ if (NOT Threads_FOUND)
+ message (STATUS " **** thread-safe package not found - threads still might work **** ")
+ endif (NOT Threads_FOUND)
+endif (HDF5_ENABLE_THREADSAFE)
# -----------------------------------------------------------------------
# wrapper script variables
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cf218d7..b7656a1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -887,6 +887,7 @@ if (BUILD_SHARED_LIBS)
APPEND PROPERTY COMPILE_DEFINITIONS
"H5_HAVE_THREADSAFE"
)
+ target_link_libraries (${HDF5_LIBSH_TARGET} Threads::Threads)
endif (HDF5_ENABLE_THREADSAFE)
if (HDF5_ENABLE_DEBUG_APIS)