ERT: link to the threads library of the OS

this is required to make the opm-core build succeed if ERT was build
with -DBUILD_SHARED_LIBS=OFF . (without it, I get errors like

    /home/and/src/ert/devel/libert_util/src/thread_pool_posix.c:328: error: undefined reference to 'pthread_create'
This commit is contained in:
Andreas Lauser 2014-07-25 15:19:09 +02:00 committed by Bård Skaflestad
parent cd8e4ad6a3
commit 926685cc2c

View File

@ -192,6 +192,13 @@ if (UNIX)
list (APPEND ERT_LIBRARIES ${MATH_LIBRARY})
endif (UNIX)
# if shared libraries are disabled on linux, explcitly linking to the
# pthreads library is required by ERT
find_package(Threads ${ERT_QUIET})
if (CMAKE_THREAD_LIBS_INIT)
list (APPEND ERT_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif()
# Platform specific library where dlopen with friends lives
list (APPEND ERT_LIBRARIES ${CMAKE_DL_LIBS})