diff --git a/CMakeLists.txt b/CMakeLists.txt index c70252e7..4e974664 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,6 +367,8 @@ if(GENESIS_USE_HTSLIB) SET( GENESIS_HTSLIB_VERSION "1.16" ) #GENESIS_HTSLIB_VERSION# # Included from modules dir tools/cmake + # htslib needs pthreads to be linked, so we include this here as well + include( IncludePthreads ) include( IncludeHtslib ) endif() @@ -468,6 +470,9 @@ IF( GENESIS_HAS_PARENT_DIR ) if(ZLIB_FOUND) set( ZLIB_FOUND ${ZLIB_FOUND} PARENT_SCOPE ) endif() + if(THREADS_FOUND) + set( THREADS_FOUND ${THREADS_FOUND} PARENT_SCOPE ) + endif() if(OPENMP_FOUND) set( OPENMP_FOUND ${OPENMP_FOUND} PARENT_SCOPE ) endif() diff --git a/tools/cmake/IncludePthreads.cmake b/tools/cmake/IncludePthreads.cmake index e29d7634..31bde951 100644 --- a/tools/cmake/IncludePthreads.cmake +++ b/tools/cmake/IncludePthreads.cmake @@ -23,10 +23,11 @@ # Use PThreads # ------------------------------------------------------------------------------ -# This file can be included from the main CMakeLists.txt in order to figure out +# This file is included from the main CMakeLists.txt in order to figure out # if Pthreads are available, and if so, set its paths and flags. -# We curently do not use this any more, as we have switched to just using -# the plain C++11 threading model instead. We keep this here for reference only. +# We curently do not use pthreads internally any more, as we have switched to just using +# the plain C++11 threading model instead. However, they seem to be needed for properly +# linking htslib... So we have to keep this around. message (STATUS "Looking for Threads") set (CMAKE_THREAD_PREFER_PTHREAD ON)