CMake: Option for enabling/disabling threads.
authorOscar Fuentes <ofv@wanadoo.es>
Tue, 18 Nov 2008 23:45:21 +0000 (23:45 +0000)
committerOscar Fuentes <ofv@wanadoo.es>
Tue, 18 Nov 2008 23:45:21 +0000 (23:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59565 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt
cmake/config-ix.cmake

index 6ef79b91deb6e2f1c37030ce03d5ff68a6a6b70d..327a6935c56a0fe432c1c48a17e32e704cb13c6b 100644 (file)
@@ -50,6 +50,8 @@ else( MSVC )
     CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
 endif( MSVC )
 
+option(LLVM_ENABLE_THREADS "Use threads if available." ON)
+
 if( LLVM_TARGETS_TO_BUILD STREQUAL "all" )
   set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
 endif()
index b8be58e1088464cdc89ba3a59cdd0f71755bcf4a..fd6f73b31cdf7abbd3bcc8ea42e30486846eaee2 100755 (executable)
@@ -93,8 +93,17 @@ endif( NOT MSVC )
 # FIXME: Signal handler return type, currently hardcoded to 'void'
 set(RETSIGTYPE void)
 
-# Disable multithreading for now
-set(ENABLE_THREADS 0)
+if( LLVM_ENABLE_THREADS )
+  if( HAVE_PTHREAD_H OR WIN32 )
+    set(ENABLE_THREADS 1)
+  endif()
+endif()
+
+if( ENABLE_THREADS )
+  message(STATUS "Threads enabled.")
+else( ENABLE_THREADS )
+  message(STATUS "Threads disabled.")
+endif()
 
 configure_file(
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake