From ba5df6606f96eaab26a18a668317072a2d6742e4 Mon Sep 17 00:00:00 2001 From: Thamme Gowda Date: Wed, 22 Nov 2023 02:00:31 -0800 Subject: [PATCH] static link Threads lib for a portable bin (#1012) * static link Threads lib for a portable bin * Changelog: Threads to EXT_LIBS --------- Co-authored-by: Thamme Gowda --- CHANGELOG.md | 2 ++ CMakeLists.txt | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4242e5c19..ba3131b8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] - Fixed compilation with clang 16.0.6 +- Added Threads::Threads to EXT_LIBS + ### Added - Added `--no-spm-encode` option, allowing the model to use vocabulary IDs directly to train/decode. diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c674e68d..9ff5e2c07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,15 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() +######## +# pThreads: consider it as EXT_LIBS for a more portable binary +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +set(THREADS_PREFER_PTHREAD_FLAG TRUE) +find_package(Threads REQUIRED) +set(EXT_LIBS ${EXT_LIBS} Threads::Threads) +######## + + ############################################################################### # Set compilation flags if(MSVC)