CMake: Link test suites with pthread if LINK_WITH_PTHREAD set

The pre-existing LINK_WITH_PTHREAD CMake option controls whether
`pthread` should be linked into the library, but didn't apply
to the test suites so far.

This commit also links test suites to `pthread` in CMake-based
builds which have LINK_WITH_PTHREAD set.
This commit is contained in:
Hanno Becker 2019-05-28 16:17:09 +01:00
parent fd8b7bd63f
commit 1ba602c2f6

View File

@ -1,3 +1,5 @@
option(LINK_WITH_PTHREAD "Explicitly link mbed TLS library to pthread." OFF)
set(libs
mbedtls
)
@ -10,6 +12,10 @@ if(ENABLE_ZLIB_SUPPORT)
set(libs ${libs} ${ZLIB_LIBRARIES})
endif(ENABLE_ZLIB_SUPPORT)
if(LINK_WITH_PTHREAD)
set(libs ${libs} pthread)
endif(LINK_WITH_PTHREAD)
find_package(Perl)
if(NOT PERL_FOUND)
message(FATAL_ERROR "Cannot build test suites without Perl")