# HG changeset patch # User Alpar Juttner # Date 2012-01-29 22:33:14 # Node ID 48e17328c1551cb8196973d6056a04e40e5d624a # Parent 43a91b33f3747428f70be1da8dbdf9da4edb3d2a LEMON_THREADING cmake variable for choosing threading lib (#223) diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,8 +115,26 @@ SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG}) INCLUDE(FindThreads) -SET(LEMON_USE_PTHREAD ${CMAKE_USE_PTHREADS_INIT}) -SET(LEMON_USE_WIN32_THREADS ${CMAKE_USE_WIN32_THREADS_INIT}) + +IF(NOT LEMON_THREADING) + IF(CMAKE_USE_PTHREADS_INIT) + SET(LEMON_THREADING "Pthread") + ELSEIF(CMAKE_USE_WIN32_THREADS_INIT) + SET(LEMON_THREADING "Win32") + ELSE() + SET(LEMON_THREADING "None") + ENDIF() +ENDIF() + +SET( LEMON_THREADING "${LEMON_THREADING}" CACHE STRING + "Choose the threading library, options are: Pthread Win32 None." + FORCE ) + +IF(LEMON_THREADING STREQUAL "Pthread") + SET(LEMON_USE_PTHREAD TRUE) +ELSEIF(LEMON_THREADING STREQUAL "Win32") + SET(LEMON_USE_WIN32_THREADS TRUE) +ENDIF() ENABLE_TESTING()