Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindBlosc.cmake: Threads #2768

Merged
merged 1 commit into from
Jun 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions cmake/FindBlosc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ if(NOT BLOSC_FOUND)
endif()
endif()

# Blosc depends on pthreads
# https://github.com/Blosc/c-blosc/blob/master/blosc/CMakeLists.txt
# https://github.com/Blosc/c-blosc/pull/318
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
if(WIN32)
# try to use the system library
find_package(Threads)
if(NOT Threads_FOUND)
message(STATUS "Blosc: used the internal pthread library for win32 systems.")
set(BLOSC_LIBRARIES)
else()
set(BLOSC_LIBRARIES Threads::Threads)
endif()
else()
find_package(Threads REQUIRED)
set(BLOSC_LIBRARIES Threads::Threads)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Blosc
FOUND_VAR BLOSC_FOUND
Expand All @@ -68,6 +86,7 @@ if(NOT BLOSC_FOUND)
set_target_properties(Blosc::Blosc PROPERTIES
IMPORTED_LOCATION "${BLOSC_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${BLOSC_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${BLOSC_LIBRARIES}"
)
endif()
endif()
Expand Down