This is an automated email from the ASF dual-hosted git repository.

junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git


The following commit(s) were added to refs/heads/main by this push:
     new 3b4a532  [CMAKE] Allow explicit turning threads off (#400)
3b4a532 is described below

commit 3b4a532763159d7810bf7094152860c97511a546
Author: Tianqi Chen <[email protected]>
AuthorDate: Sun Jan 11 17:49:46 2026 -0500

    [CMAKE] Allow explicit turning threads off (#400)
---
 CMakeLists.txt | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 395bd74..7ba198c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,7 @@ project(tvm_ffi LANGUAGES CXX C)
 
 option(TVM_FFI_USE_LIBBACKTRACE "Enable libbacktrace" ON)
 option(TVM_FFI_USE_EXTRA_CXX_API "Enable extra CXX API in shared lib" ON)
+option(TVM_FFI_USE_THREADS "Link against threads in shared lib" ON)
 option(TVM_FFI_BACKTRACE_ON_SEGFAULT "Set signal handler to print backtrace on 
segfault" ON)
 
 include(${CMAKE_CURRENT_LIST_DIR}/cmake/Utils/DetectTargetTriple.cmake)
@@ -122,10 +123,8 @@ endif ()
 tvm_ffi_add_msvc_flags(tvm_ffi_objs)
 tvm_ffi_add_target_from_obj(tvm_ffi tvm_ffi_objs)
 
-find_package(Threads)
-if (Threads_FOUND)
-  # link to threads library if found on some cross-compilation platforms, the 
threads library maynot
-  # be found but downstream may still be able to build extra alternatives via 
source bundle
+if (TVM_FFI_USE_THREADS)
+  find_package(Threads REQUIRED)
   target_link_libraries(tvm_ffi_shared PRIVATE Threads::Threads)
   target_link_libraries(tvm_ffi_static INTERFACE Threads::Threads)
 endif ()

Reply via email to