From 1ba602c2f6a5a23110aa05c125a51c79ce9aaafc Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Tue, 28 May 2019 16:17:09 +0100 Subject: [PATCH] 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. --- tests/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a8e7523e5..5938a5fc8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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")