aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPaul Elliott <paul.elliott@arm.com>2024-01-24 18:05:53 +0000
committerPaul Elliott <paul.elliott@arm.com>2024-01-24 18:05:53 +0000
commit7fd162ec262408e4700f95bfe90638dca5247967 (patch)
tree4a9a9a4a0a37eddb6e7193179f2184d63df118d2 /CMakeLists.txt
parented3ba3cc8e23c0776ca23293a25d747b7183e10e (diff)
downloadmbedtls-7fd162ec262408e4700f95bfe90638dca5247967.zip
mbedtls-7fd162ec262408e4700f95bfe90638dca5247967.tar.gz
mbedtls-7fd162ec262408e4700f95bfe90638dca5247967.tar.bz2
Refactor common PThreads CMake code
Move the flags and find of Threads to root CMakeLists.txt, rather than duplicate these everywhere. Make explicit linking of library with PThreads use the same mechanism. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad05646..68dfcb0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -114,6 +114,11 @@ if(MBEDTLS_PYTHON_EXECUTABLE)
endif()
+# We now potentially need to link all executables against PThreads, if available
+set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+set(THREADS_PREFER_PTHREAD_FLAG TRUE)
+find_package(Threads)
+
# If this is the root project add longer list of available CMAKE_BUILD_TYPE values
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}