summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome Soumagne <jsoumagne@hdfgroup.org>2019-03-13 20:25:23 (GMT)
committerJerome Soumagne <jsoumagne@hdfgroup.org>2019-03-13 20:25:23 (GMT)
commit0ea7aa89ff872f810285b12ddde5d55165534afa (patch)
tree8343c19cb67992bf1a3498c9cb2629ebfb5a1638
parent07baf44a86de400c170006557e7595ea6ba9c20a (diff)
parentdc69df49e6a8896606c9e4bd0987613a02f7a25a (diff)
downloadhdf5-0ea7aa89ff872f810285b12ddde5d55165534afa.zip
hdf5-0ea7aa89ff872f810285b12ddde5d55165534afa.tar.gz
hdf5-0ea7aa89ff872f810285b12ddde5d55165534afa.tar.bz2
Merge pull request #1601 in HDFFV/hdf5 from ~JSOUMAGNE/hdf5:topic_thread_private to develop
* commit 'dc69df49e6a8896606c9e4bd0987613a02f7a25a': CMake: fix pthread linking to only be private
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--test/CMakeLists.txt7
2 files changed, 9 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 83240bd..5f7bd48 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1120,7 +1120,7 @@ target_link_libraries (${HDF5_LIB_TARGET}
)
if (NOT WIN32)
target_link_libraries (${HDF5_LIB_TARGET}
- PUBLIC $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
)
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET})
@@ -1152,8 +1152,8 @@ if (BUILD_SHARED_LIBS)
)
TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_LIBSH_TARGET}
- PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
- PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}> $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>
)
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")
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 276cf09..772f790 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -352,12 +352,17 @@ add_executable (ttsafe ${ttsafe_SOURCES})
target_include_directories(ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (ttsafe STATIC)
target_link_libraries (ttsafe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+if (NOT WIN32)
+ target_link_libraries (ttsafe
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ )
+endif ()
set_target_properties (ttsafe PROPERTIES FOLDER test)
if (BUILD_SHARED_LIBS)
add_executable (ttsafe-shared ${ttsafe_SOURCES})
target_include_directories(ttsafe-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (ttsafe-shared SHARED)
- target_link_libraries (ttsafe-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ target_link_libraries (ttsafe-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>)
set_target_properties (ttsafe-shared PROPERTIES FOLDER test)
endif ()