[svn-r28228] Remove WIN32 only config of threadsafe

This commit is contained in:
Allen Byrne 2015-10-26 15:09:22 -05:00
parent acbb71201b
commit 00aaf8e6f4
2 changed files with 48 additions and 46 deletions

View File

@ -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

View File

@ -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)